From a7f2b2ba3f13ceb60376802f4a31e104153839e8 Mon Sep 17 00:00:00 2001 From: Marc Jeanmougin Date: Tue, 17 Feb 2015 03:00:37 +0100 Subject: At first, I was thinking "I just have to go to the selection file, and change that GSList* with a std::list, then resolve the few problems" So, i tried that. And I will continue tomorrow, and the days after, on and on. (bzr r13922.1.1) --- src/gradient-drag.cpp | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'src/gradient-drag.cpp') diff --git a/src/gradient-drag.cpp b/src/gradient-drag.cpp index 154b7339b..649928060 100644 --- a/src/gradient-drag.cpp +++ b/src/gradient-drag.cpp @@ -2082,9 +2082,9 @@ void GrDrag::updateDraggers() this->draggers = NULL; g_return_if_fail(this->selection != NULL); - - for (GSList const* i = this->selection->itemList(); i != NULL; i = i->next) { - SPItem *item = SP_ITEM(i->data); + SelContainer list = this->selection->itemList(); + for (SelContainer::const_iterator i=list.begin();i!=list.end();i++) { + SPItem *item = SP_ITEM(*i); SPStyle *style = item->style; if (style && (style->fill.isPaintserver())) { @@ -2151,9 +2151,9 @@ void GrDrag::updateLines() g_return_if_fail(this->selection != NULL); - for (GSList const* i = this->selection->itemList(); i != NULL; i = i->next) { - - SPItem *item = SP_ITEM(i->data); + SelContainer list = this->selection->itemList(); + for (SelContainer::const_iterator i=list.begin();i!=list.end();i++) { + SPItem *item = SP_ITEM(*i); SPStyle *style = item->style; @@ -2295,8 +2295,9 @@ void GrDrag::updateLevels() g_return_if_fail (this->selection != NULL); - for (GSList const* i = this->selection->itemList(); i != NULL; i = i->next) { - SPItem *item = SP_ITEM(i->data); + SelContainer list = this->selection->itemList(); + for (SelContainer::const_iterator i=list.begin();i!=list.end();i++) { + SPItem *item = SP_ITEM(*i); Geom::OptRect rect = item->desktopVisualBounds(); if (rect) { // Remember the edges of the bbox and the center axis -- cgit v1.2.3 From 5fd00cab14d48beaf2279a2b8f3ad5b02b76c87b Mon Sep 17 00:00:00 2001 From: Marc Jeanmougin Date: Thu, 19 Feb 2015 04:25:21 +0100 Subject: Put a few std::vector (bzr r13922.1.5) --- src/gradient-drag.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/gradient-drag.cpp') diff --git a/src/gradient-drag.cpp b/src/gradient-drag.cpp index 649928060..525fc074f 100644 --- a/src/gradient-drag.cpp +++ b/src/gradient-drag.cpp @@ -2082,8 +2082,8 @@ void GrDrag::updateDraggers() this->draggers = NULL; g_return_if_fail(this->selection != NULL); - SelContainer list = this->selection->itemList(); - for (SelContainer::const_iterator i=list.begin();i!=list.end();i++) { + std::vector list = this->selection->itemList(); + for (std::vector::const_iterator i=list.begin();i!=list.end();i++) { SPItem *item = SP_ITEM(*i); SPStyle *style = item->style; @@ -2151,8 +2151,8 @@ void GrDrag::updateLines() g_return_if_fail(this->selection != NULL); - SelContainer list = this->selection->itemList(); - for (SelContainer::const_iterator i=list.begin();i!=list.end();i++) { + std::vector list = this->selection->itemList(); + for (std::vector::const_iterator i=list.begin();i!=list.end();i++) { SPItem *item = SP_ITEM(*i); SPStyle *style = item->style; @@ -2295,8 +2295,8 @@ void GrDrag::updateLevels() g_return_if_fail (this->selection != NULL); - SelContainer list = this->selection->itemList(); - for (SelContainer::const_iterator i=list.begin();i!=list.end();i++) { + std::vector list = this->selection->itemList(); + for (std::vector::const_iterator i=list.begin();i!=list.end();i++) { SPItem *item = SP_ITEM(*i); Geom::OptRect rect = item->desktopVisualBounds(); if (rect) { -- cgit v1.2.3 From 9a7fa4d1899d30ec745107823f307b2a0bf3172f Mon Sep 17 00:00:00 2001 From: Marc Jeanmougin Date: Fri, 27 Feb 2015 03:10:36 +0100 Subject: corrected the casts (hopefully) (bzr r13922.1.10) --- src/gradient-drag.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/gradient-drag.cpp') diff --git a/src/gradient-drag.cpp b/src/gradient-drag.cpp index 525fc074f..5a49435d4 100644 --- a/src/gradient-drag.cpp +++ b/src/gradient-drag.cpp @@ -2083,8 +2083,8 @@ void GrDrag::updateDraggers() g_return_if_fail(this->selection != NULL); std::vector list = this->selection->itemList(); - for (std::vector::const_iterator i=list.begin();i!=list.end();i++) { - SPItem *item = SP_ITEM(*i); + for (std::vector::const_iterator i = list.begin(); i != list.end(); i++) { + SPItem *item = *i; SPStyle *style = item->style; if (style && (style->fill.isPaintserver())) { @@ -2152,8 +2152,8 @@ void GrDrag::updateLines() g_return_if_fail(this->selection != NULL); std::vector list = this->selection->itemList(); - for (std::vector::const_iterator i=list.begin();i!=list.end();i++) { - SPItem *item = SP_ITEM(*i); + for (std::vector::const_iterator i = list.begin(); i != list.end(); i++) { + SPItem *item = *i; SPStyle *style = item->style; @@ -2296,8 +2296,8 @@ void GrDrag::updateLevels() g_return_if_fail (this->selection != NULL); std::vector list = this->selection->itemList(); - for (std::vector::const_iterator i=list.begin();i!=list.end();i++) { - SPItem *item = SP_ITEM(*i); + for (std::vector::const_iterator i = list.begin(); i != list.end(); i++) { + SPItem *item = *i; Geom::OptRect rect = item->desktopVisualBounds(); if (rect) { // Remember the edges of the bbox and the center axis -- cgit v1.2.3 From c883d7627a479c8c5b6a9f77b9841fa5631572ad Mon Sep 17 00:00:00 2001 From: Krzysztof Kosi??ski Date: Mon, 27 Apr 2015 19:39:29 -0400 Subject: 2Geom sync - initial commit (bzr r14059.2.1) --- src/gradient-drag.cpp | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'src/gradient-drag.cpp') diff --git a/src/gradient-drag.cpp b/src/gradient-drag.cpp index cb2bd737f..7af7b11b2 100644 --- a/src/gradient-drag.cpp +++ b/src/gradient-drag.cpp @@ -378,7 +378,7 @@ SPStop *GrDrag::addStopNearPoint(SPItem *item, Geom::Point mouse_p, double toler Geom::Point begin = getGradientCoords(item, POINT_LG_BEGIN, 0, fill_or_stroke); Geom::Point end = getGradientCoords(item, POINT_LG_END, 0, fill_or_stroke); Geom::LineSegment ls(begin, end); - double offset = ls.nearestPoint(mouse_p); + double offset = ls.nearestTime(mouse_p); Geom::Point nearest = ls.pointAt(offset); double dist_screen = Geom::distance(mouse_p, nearest); if ( dist_screen < tolerance ) { @@ -391,7 +391,7 @@ SPStop *GrDrag::addStopNearPoint(SPItem *item, Geom::Point mouse_p, double toler Geom::Point begin = getGradientCoords(item, POINT_RG_CENTER, 0, fill_or_stroke); Geom::Point end = getGradientCoords(item, POINT_RG_R1, 0, fill_or_stroke); Geom::LineSegment ls(begin, end); - double offset = ls.nearestPoint(mouse_p); + double offset = ls.nearestTime(mouse_p); Geom::Point nearest = ls.pointAt(offset); double dist_screen = Geom::distance(mouse_p, nearest); if ( dist_screen < tolerance ) { @@ -403,7 +403,7 @@ SPStop *GrDrag::addStopNearPoint(SPItem *item, Geom::Point mouse_p, double toler } else { end = getGradientCoords(item, POINT_RG_R2, 0, fill_or_stroke); ls = Geom::LineSegment(begin, end); - offset = ls.nearestPoint(mouse_p); + offset = ls.nearestTime(mouse_p); nearest = ls.pointAt(offset); dist_screen = Geom::distance(mouse_p, nearest); if ( dist_screen < tolerance ) { @@ -442,7 +442,7 @@ SPStop *GrDrag::addStopNearPoint(SPItem *item, Geom::Point mouse_p, double toler p[2] = patch.getPoint( 0, 2 ) * transform; p[3] = patch.getPoint( 0, 3 ) * transform; Geom::BezierCurveN<3> b( p[0], p[1], p[2], p[3] ); - Geom::Coord coord = b.nearestPoint( mouse_p ); + Geom::Coord coord = b.nearestTime( mouse_p ); Geom::Point nearest = b( coord ); double dist_screen = Geom::L2 ( mouse_p - nearest ); if ( dist_screen < closest ) { @@ -460,7 +460,7 @@ SPStop *GrDrag::addStopNearPoint(SPItem *item, Geom::Point mouse_p, double toler p[2] = patch.getPoint( 1, 2 ) * transform; p[3] = patch.getPoint( 1, 3 ) * transform; Geom::BezierCurveN<3> b( p[0], p[1], p[2], p[3] ); - Geom::Coord coord = b.nearestPoint( mouse_p ); + Geom::Coord coord = b.nearestTime( mouse_p ); Geom::Point nearest = b( coord ); double dist_screen = Geom::L2 ( mouse_p - nearest ); if ( dist_screen < closest ) { @@ -478,7 +478,7 @@ SPStop *GrDrag::addStopNearPoint(SPItem *item, Geom::Point mouse_p, double toler p[2] = patch.getPoint( 2, 2 ) * transform; p[3] = patch.getPoint( 2, 3 ) * transform; Geom::BezierCurveN<3> b( p[0], p[1], p[2], p[3] ); - Geom::Coord coord = b.nearestPoint( mouse_p ); + Geom::Coord coord = b.nearestTime( mouse_p ); Geom::Point nearest = b( coord ); double dist_screen = Geom::L2 ( mouse_p - nearest ); if ( dist_screen < closest ) { @@ -496,7 +496,7 @@ SPStop *GrDrag::addStopNearPoint(SPItem *item, Geom::Point mouse_p, double toler p[2] = patch.getPoint( 3, 2 ) * transform; p[3] = patch.getPoint( 3, 3 ) * transform; Geom::BezierCurveN<3> b( p[0], p[1], p[2], p[3] ); - Geom::Coord coord = b.nearestPoint( mouse_p ); + Geom::Coord coord = b.nearestTime( mouse_p ); Geom::Point nearest = b( coord ); double dist_screen = Geom::L2 ( mouse_p - nearest ); if ( dist_screen < closest ) { @@ -603,7 +603,7 @@ bool GrDrag::dropColor(SPItem */*item*/, gchar const *c, Geom::Point p) for (GSList *l = lines; (l != NULL) && (!over_line); l = l->next) { SPCtrlLine *line = (SPCtrlLine*) l->data; Geom::LineSegment ls(line->s, line->e); - Geom::Point nearest = ls.pointAt(ls.nearestPoint(p)); + Geom::Point nearest = ls.pointAt(ls.nearestTime(p)); double dist_screen = Geom::L2(p - nearest) * desktop->current_zoom(); if (line->item && dist_screen < 5) { SPStop *stop = addStopNearPoint(line->item, p, 5/desktop->current_zoom()); @@ -1018,10 +1018,10 @@ static void gr_knot_moved_midpoint_handler(SPKnot */*knot*/, Geom::Point const & if (state & GDK_CONTROL_MASK) { Geom::LineSegment ls(low_lim, high_lim); - p = ls.pointAt(round(ls.nearestPoint(p) / snap_fraction) * snap_fraction); + p = ls.pointAt(round(ls.nearestTime(p) / snap_fraction) * snap_fraction); } else { Geom::LineSegment ls(low_lim, high_lim); - p = ls.pointAt(ls.nearestPoint(p)); + p = ls.pointAt(ls.nearestTime(p)); if (!(state & GDK_SHIFT_MASK)) { Inkscape::Snapper::SnapConstraint cl(low_lim, high_lim - low_lim); SPDesktop *desktop = dragger->parent->desktop; @@ -2393,7 +2393,7 @@ void GrDrag::selected_move(double x, double y, bool write_repr, bool scale_radia gr_midpoint_limits(dragger, server, &begin, &end, &low_lim, &high_lim, &moving); Geom::LineSegment ls(low_lim, high_lim); - Geom::Point p = ls.pointAt(ls.nearestPoint(dragger->point + Geom::Point(x,y))); + Geom::Point p = ls.pointAt(ls.nearestTime(dragger->point + Geom::Point(x,y))); Geom::Point displacement = p - dragger->point; for (GSList const* i = moving; i != NULL; i = i->next) { -- cgit v1.2.3 From 48e0423afcb02fe4a0f705d828a0dbdb3106b397 Mon Sep 17 00:00:00 2001 From: Marc Jeanmougin Date: Fri, 8 May 2015 15:46:25 +0200 Subject: fixes a few of jenkins warnings (bzr r14126) --- src/gradient-drag.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/gradient-drag.cpp') diff --git a/src/gradient-drag.cpp b/src/gradient-drag.cpp index 169710114..b22714959 100644 --- a/src/gradient-drag.cpp +++ b/src/gradient-drag.cpp @@ -1155,7 +1155,7 @@ static void gr_knot_clicked_handler(SPKnot */*knot*/, guint state, gpointer data break; default: - break; + return; } -- cgit v1.2.3