From 8f98763698eeafecea1f8475b089ec51268fcea0 Mon Sep 17 00:00:00 2001 From: verbalshadow Date: Fri, 5 Dec 2008 22:40:41 +0000 Subject: [PATCH] NR -> 2Geom few more files --- src/knotholder.cpp | 4 ++-- src/knotholder.h | 2 +- src/rect-context.cpp | 14 +++++++------- src/rect-context.h | 2 +- src/sp-conn-end-pair.cpp | 18 +++++++++--------- src/sp-conn-end-pair.h | 2 +- src/sp-ellipse.cpp | 22 +++++++++++----------- src/sp-ellipse.h | 2 +- 8 files changed, 33 insertions(+), 33 deletions(-) diff --git a/src/knotholder.cpp b/src/knotholder.cpp index f7935c7c3..0cb9fc423 100644 --- a/src/knotholder.cpp +++ b/src/knotholder.cpp @@ -78,7 +78,7 @@ KnotHolder::~KnotHolder() { void KnotHolder::update_knots() { - NR::Matrix const i2d(sp_item_i2d_affine(item)); + Geom::Matrix const i2d(sp_item_i2d_affine(item)); for(std::list::iterator i = entity.begin(); i != entity.end(); ++i) { KnotHolderEntity *e = *i; @@ -139,7 +139,7 @@ KnotHolder::knot_moved_handler(SPKnot *knot, Geom::Point const &p, guint state) for(std::list::iterator i = this->entity.begin(); i != this->entity.end(); ++i) { KnotHolderEntity *e = *i; if (e->knot == knot) { - NR::Point const q = p * sp_item_i2d_affine(item).inverse(); + Geom::Point const q = p * sp_item_i2d_affine(item).inverse(); e->knot_set(q, e->knot->drag_origin * sp_item_i2d_affine(item).inverse(), state); break; } diff --git a/src/knotholder.h b/src/knotholder.h index 25d6d4638..310adab61 100644 --- a/src/knotholder.h +++ b/src/knotholder.h @@ -64,7 +64,7 @@ protected: /** void knot_clicked_handler(SPKnot *knot, guint state, gpointer data); -void knot_moved_handler(SPKnot *knot, NR::Point const *p, guint state, gpointer data); +void knot_moved_handler(SPKnot *knot, Geom::Point const *p, guint state, gpointer data); void knot_ungrabbed_handler(SPKnot *knot, unsigned int state, KnotHolder *kh); **/ diff --git a/src/rect-context.cpp b/src/rect-context.cpp index 93e7e8470..5d2a353d9 100644 --- a/src/rect-context.cpp +++ b/src/rect-context.cpp @@ -54,7 +54,7 @@ static void sp_rect_context_set(SPEventContext *ec, Inkscape::Preferences::Entry static gint sp_rect_context_root_handler(SPEventContext *event_context, GdkEvent *event); static gint sp_rect_context_item_handler(SPEventContext *event_context, SPItem *item, GdkEvent *event); -static void sp_rect_drag(SPRectContext &rc, NR::Point const pt, guint state); +static void sp_rect_drag(SPRectContext &rc, Geom::Point const pt, guint state); static void sp_rect_finish(SPRectContext *rc); static SPEventContextClass *parent_class; @@ -285,12 +285,12 @@ static gint sp_rect_context_root_handler(SPEventContext *event_context, GdkEvent switch (event->type) { case GDK_BUTTON_PRESS: if (event->button.button == 1 && !event_context->space_panning) { - NR::Point const button_w(event->button.x, + Geom::Point const button_w(event->button.x, event->button.y); // save drag origin - event_context->xp = (gint) button_w[NR::X]; - event_context->yp = (gint) button_w[NR::Y]; + event_context->xp = (gint) button_w[Geom::X]; + event_context->yp = (gint) button_w[Geom::Y]; event_context->within_tolerance = true; // remember clicked item, disregarding groups, honoring Alt @@ -333,8 +333,8 @@ static gint sp_rect_context_root_handler(SPEventContext *event_context, GdkEvent // motion notify coordinates as given (no snapping back to origin) event_context->within_tolerance = false; - NR::Point const motion_w(event->motion.x, event->motion.y); - NR::Point motion_dt(desktop->w2d(motion_w)); + Geom::Point const motion_w(event->motion.x, event->motion.y); + Geom::Point motion_dt(desktop->w2d(motion_w)); sp_rect_drag(*rc, motion_dt, event->motion.state); // this will also handle the snapping gobble_motion_events(GDK_BUTTON1_MASK); @@ -460,7 +460,7 @@ static gint sp_rect_context_root_handler(SPEventContext *event_context, GdkEvent return ret; } -static void sp_rect_drag(SPRectContext &rc, NR::Point const pt, guint state) +static void sp_rect_drag(SPRectContext &rc, Geom::Point const pt, guint state) { SPDesktop *desktop = SP_EVENT_CONTEXT(&rc)->desktop; diff --git a/src/rect-context.h b/src/rect-context.h index ae2680f8f..0445338bf 100644 --- a/src/rect-context.h +++ b/src/rect-context.h @@ -29,7 +29,7 @@ class SPRectContextClass; struct SPRectContext : public SPEventContext { SPItem *item; - NR::Point center; + Geom::Point center; gdouble rx; /* roundness radius (x direction) */ gdouble ry; /* roundness radius (y direction) */ diff --git a/src/sp-conn-end-pair.cpp b/src/sp-conn-end-pair.cpp index fbc4a93ca..49d6fbcdb 100644 --- a/src/sp-conn-end-pair.cpp +++ b/src/sp-conn-end-pair.cpp @@ -160,7 +160,7 @@ SPConnEndPair::getAttachedItems(SPItem *h2attItem[2]) const { } void -SPConnEndPair::getEndpoints(NR::Point endPts[]) const { +SPConnEndPair::getEndpoints(Geom::Point endPts[]) const { SPCurve *curve = _path->curve; SPItem *h2attItem[2]; getAttachedItems(h2attItem); @@ -172,7 +172,7 @@ SPConnEndPair::getEndpoints(NR::Point endPts[]) const { endPts[h] = bbox->midpoint(); } else { // FIXME - endPts[h] = NR::Point(0, 0); + endPts[h] = Geom::Point(0, 0); } } else @@ -225,11 +225,11 @@ SPConnEndPair::update(void) if (_connType != SP_CONNECTOR_NOAVOID) { g_assert(_connRef != NULL); if (!(_connRef->isInitialised())) { - NR::Point endPt[2]; + Geom::Point endPt[2]; getEndpoints(endPt); - Avoid::Point src(endPt[0][NR::X], endPt[0][NR::Y]); - Avoid::Point dst(endPt[1][NR::X], endPt[1][NR::Y]); + Avoid::Point src(endPt[0][Geom::X], endPt[0][Geom::Y]); + Avoid::Point dst(endPt[1][Geom::X], endPt[1][Geom::Y]); _connRef->lateSetup(src, dst); _connRef->setCallback(&emitPathInvalidationNotification, _path); @@ -288,11 +288,11 @@ SPConnEndPair::reroutePath(void) SPCurve *curve = _path->curve; - NR::Point endPt[2]; + Geom::Point endPt[2]; getEndpoints(endPt); - Avoid::Point src(endPt[0][NR::X], endPt[0][NR::Y]); - Avoid::Point dst(endPt[1][NR::X], endPt[1][NR::Y]); + Avoid::Point src(endPt[0][Geom::X], endPt[0][Geom::Y]); + Avoid::Point dst(endPt[1][Geom::X], endPt[1][Geom::Y]); _connRef->updateEndPoint(Avoid::VertID::src, src); _connRef->updateEndPoint(Avoid::VertID::tar, dst); @@ -306,7 +306,7 @@ SPConnEndPair::reroutePath(void) curve->moveto(endPt[0]); for (int i = 1; i < route.pn; ++i) { - NR::Point p(route.ps[i].x, route.ps[i].y); + Geom::Point p(route.ps[i].x, route.ps[i].y); curve->lineto(p); } } diff --git a/src/sp-conn-end-pair.h b/src/sp-conn-end-pair.h index 3f130da32..9b9e181db 100644 --- a/src/sp-conn-end-pair.h +++ b/src/sp-conn-end-pair.h @@ -37,7 +37,7 @@ public: void setAttr(unsigned const key, gchar const *const value); void writeRepr(Inkscape::XML::Node *const repr) const; void getAttachedItems(SPItem *[2]) const; - void getEndpoints(NR::Point endPts[]) const; + void getEndpoints(Geom::Point endPts[]) const; void reroutePath(void); void makePathInvalid(void); void update(void); diff --git a/src/sp-ellipse.cpp b/src/sp-ellipse.cpp index bee7e1b5d..c7ed88513 100644 --- a/src/sp-ellipse.cpp +++ b/src/sp-ellipse.cpp @@ -264,7 +264,7 @@ static void sp_genericellipse_snappoints(SPItem const *item, SnapPointsIter p, I SPGenericEllipse *ellipse = SP_GENERICELLIPSE(item); sp_genericellipse_normalize(ellipse); - NR::Matrix const i2d = sp_item_i2d_affine(item); + Geom::Matrix const i2d = sp_item_i2d_affine(item); // figure out if we have a slice, whilst guarding against rounding errors bool slice = false; @@ -287,7 +287,7 @@ static void sp_genericellipse_snappoints(SPItem const *item, SnapPointsIter p, I double angle = 0; for (angle = 0; angle < SP_2PI; angle += M_PI_2) { if (angle >= ellipse->start && angle <= ellipse->end) { - *p = NR::Point(cx + cos(angle)*rx, cy + sin(angle)*ry) * i2d; + *p = Geom::Point(cx + cos(angle)*rx, cy + sin(angle)*ry) * i2d; } } @@ -295,15 +295,15 @@ static void sp_genericellipse_snappoints(SPItem const *item, SnapPointsIter p, I if (slice) { // Add the centre, if we have a closed slice if (ellipse->closed) { - *p = NR::Point(cx, cy) * i2d; + *p = Geom::Point(cx, cy) * i2d; } // Add the start point, if it's not coincident with a quadrant point if (fmod(ellipse->start, M_PI_2) != 0.0 ) { - *p = NR::Point(cx + cos(ellipse->start)*rx, cy + sin(ellipse->start)*ry) * i2d; + *p = Geom::Point(cx + cos(ellipse->start)*rx, cy + sin(ellipse->start)*ry) * i2d; } // Add the end point, if it's not coincident with a quadrant point if (fmod(ellipse->end, M_PI_2) != 0.0 ) { - *p = NR::Point(cx + cos(ellipse->end)*rx, cy + sin(ellipse->end)*ry) * i2d; + *p = Geom::Point(cx + cos(ellipse->end)*rx, cy + sin(ellipse->end)*ry) * i2d; } } } @@ -707,8 +707,8 @@ sp_arc_set_elliptical_path_attribute(SPArc *arc, Inkscape::XML::Node *repr) Inkscape::SVG::PathString str; - NR::Point p1 = sp_arc_get_xy(arc, ge->start); - NR::Point p2 = sp_arc_get_xy(arc, ge->end); + Geom::Point p1 = sp_arc_get_xy(arc, ge->start); + Geom::Point p2 = sp_arc_get_xy(arc, ge->end); double rx = ge->rx.computed; double ry = ge->ry.computed; @@ -716,7 +716,7 @@ sp_arc_set_elliptical_path_attribute(SPArc *arc, Inkscape::XML::Node *repr) double dt = fmod(ge->end - ge->start, SP_2PI); if (fabs(dt) < 1e-6) { - NR::Point ph = sp_arc_get_xy(arc, (ge->start + ge->end) / 2.0); + Geom::Point ph = sp_arc_get_xy(arc, (ge->start + ge->end) / 2.0); str.arcTo(rx, ry, 0, true, true, ph) .arcTo(rx, ry, 0, true, true, p2) .closePath(); @@ -725,7 +725,7 @@ sp_arc_set_elliptical_path_attribute(SPArc *arc, Inkscape::XML::Node *repr) bool fs = (dt > 0); str.arcTo(rx, ry, 0, fa, fs, p2); if (ge->closed) { - NR::Point center = NR::Point(ge->cx.computed, ge->cy.computed); + Geom::Point center = Geom::Point(ge->cx.computed, ge->cy.computed); str.lineTo(center).closePath(); } } @@ -880,11 +880,11 @@ sp_arc_position_set(SPArc *arc, gdouble x, gdouble y, gdouble rx, gdouble ry) ((SPObject *)arc)->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG); } -NR::Point sp_arc_get_xy(SPArc *arc, gdouble arg) +Geom::Point sp_arc_get_xy(SPArc *arc, gdouble arg) { SPGenericEllipse *ge = SP_GENERICELLIPSE(arc); - return NR::Point(ge->rx.computed * cos(arg) + ge->cx.computed, + return Geom::Point(ge->rx.computed * cos(arg) + ge->cx.computed, ge->ry.computed * sin(arg) + ge->cy.computed); } diff --git a/src/sp-ellipse.h b/src/sp-ellipse.h index a1f79e6f5..91354ab60 100644 --- a/src/sp-ellipse.h +++ b/src/sp-ellipse.h @@ -100,6 +100,6 @@ struct SPArcClass { GType sp_arc_get_type (void); void sp_arc_position_set (SPArc * arc, gdouble x, gdouble y, gdouble rx, gdouble ry); -NR::Point sp_arc_get_xy (SPArc *ge, gdouble arg); +Geom::Point sp_arc_get_xy (SPArc *ge, gdouble arg); #endif -- 2.30.2