From 003725d316171849211106435e09bb28c59cd30c Mon Sep 17 00:00:00 2001 From: verbalshadow Date: Thu, 4 Dec 2008 01:28:36 +0000 Subject: [PATCH] NR -> 2geom some headers in src/ --- src/sp-offset.cpp | 24 ++++++++-------- src/sp-offset.h | 4 +-- src/sp-rect.cpp | 66 ++++++++++++++++++++++---------------------- src/sp-rect.h | 2 +- src/sp-star.cpp | 58 +++++++++++++++++++------------------- src/sp-star.h | 6 ++-- src/sp-text.cpp | 16 +++++------ src/sp-text.h | 2 +- src/sp-use.cpp | 14 +++++----- src/sp-use.h | 4 +-- src/star-context.cpp | 8 +++--- src/star-context.h | 2 +- src/text-editing.cpp | 6 ++-- src/text-editing.h | 2 +- 14 files changed, 107 insertions(+), 107 deletions(-) diff --git a/src/sp-offset.cpp b/src/sp-offset.cpp index faa2cf457..39b8227a4 100644 --- a/src/sp-offset.cpp +++ b/src/sp-offset.cpp @@ -513,7 +513,7 @@ sp_offset_set_shape(SPShape *shape) Geom::OptRect bbox = sp_item_bbox_desktop (item); if ( bbox ) { gdouble size = L2(bbox->dimensions()); - gdouble const exp = NR::expansion(item->transform); + gdouble const exp = item->transform.descrim(); if (exp != 0) size /= exp; orig->Coalesce (size * 0.001); @@ -746,9 +746,9 @@ static void sp_offset_snappoints(SPItem const *item, SnapPointsIter p, Inkscape: * -- njh */ bool -vectors_are_clockwise (NR::Point A, NR::Point B, NR::Point C) +vectors_are_clockwise (Geom::Point A, Geom::Point B, Geom::Point C) { - using NR::rot90; + using Geom::rot90; double ab_s = dot(A, rot90(B)); double ab_c = dot(A, B); double bc_s = dot(B, rot90(C)); @@ -794,7 +794,7 @@ vectors_are_clockwise (NR::Point A, NR::Point B, NR::Point C) * 'px inside source'. */ double -sp_offset_distance_to_original (SPOffset * offset, NR::Point px) +sp_offset_distance_to_original (SPOffset * offset, Geom::Point px) { if (offset == NULL || offset->originalPath == NULL || ((Path *) offset->originalPath)->descr_cmd.size() <= 1) @@ -832,14 +832,14 @@ sp_offset_distance_to_original (SPOffset * offset, NR::Point px) { if (theRes->getPoint(i).totalDegree() > 0) { - NR::Point nx = theRes->getPoint(i).x; - NR::Point nxpx = px-nx; + Geom::Point nx = theRes->getPoint(i).x; + Geom::Point nxpx = px-nx; double ndist = sqrt (dot(nxpx,nxpx)); if (ptSet == false || fabs (ndist) < fabs (ptDist)) { // we have a new minimum distance // now we need to wheck if px is inside or outside (for the sign) - nx = px - theRes->getPoint(i).x; + nx = px - to_2geom(theRes->getPoint(i).x); double nlen = sqrt (dot(nx , nx)); nx /= nlen; int pb, cb, fb; @@ -849,7 +849,7 @@ sp_offset_distance_to_original (SPOffset * offset, NR::Point px) do { // one angle - NR::Point prx, nex; + Geom::Point prx, nex; prx = theRes->getEdge(pb).dx; nlen = sqrt (dot(prx, prx)); prx /= nlen; @@ -890,13 +890,13 @@ sp_offset_distance_to_original (SPOffset * offset, NR::Point px) // loop over the edges to try to improve the distance for (int i = 0; i < theRes->numberOfEdges(); i++) { - NR::Point sx = theRes->getPoint(theRes->getEdge(i).st).x; - NR::Point ex = theRes->getPoint(theRes->getEdge(i).en).x; - NR::Point nx = ex - sx; + Geom::Point sx = theRes->getPoint(theRes->getEdge(i).st).x; + Geom::Point ex = theRes->getPoint(theRes->getEdge(i).en).x; + Geom::Point nx = ex - sx; double len = sqrt (dot(nx,nx)); if (len > 0.0001) { - NR::Point pxsx=px-sx; + Geom::Point pxsx=px-sx; double ab = dot(nx,pxsx); if (ab > 0 && ab < len * len) { diff --git a/src/sp-offset.h b/src/sp-offset.h index 0e1a9d4e5..caecdb1be 100644 --- a/src/sp-offset.h +++ b/src/sp-offset.h @@ -63,7 +63,7 @@ struct SPOffset : public SPShape { /// for interactive setting of the radius bool knotSet; - NR::Point knot; + Geom::Point knot; bool sourceDirty; bool isUpdating; @@ -89,7 +89,7 @@ struct SPOffsetClass /* Standard Gtk function */ GType sp_offset_get_type (void); -double sp_offset_distance_to_original (SPOffset * offset, NR::Point px); +double sp_offset_distance_to_original (SPOffset * offset, Geom::Point px); void sp_offset_top_point (SPOffset * offset, Geom::Point *px); SPItem *sp_offset_get_source (SPOffset *offset); diff --git a/src/sp-rect.cpp b/src/sp-rect.cpp index ab0ea3d72..c568b44be 100644 --- a/src/sp-rect.cpp +++ b/src/sp-rect.cpp @@ -176,7 +176,7 @@ 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 d = NR::expansion(ictx->i2vp); + double const d = ictx->i2vp.descrim(); double const w = (ictx->vp.x1 - ictx->vp.x0) / d; double const h = (ictx->vp.y1 - ictx->vp.y0) / d; double const em = style->font_size.computed; @@ -400,11 +400,11 @@ sp_rect_set_transform(SPItem *item, Geom::Matrix const &xform) Returns the ratio in which the vector from p0 to p1 is stretched by transform */ static gdouble -vector_stretch(NR::Point p0, NR::Point p1, NR::Matrix xform) +vector_stretch(Geom::Point p0, Geom::Point p1, Geom::Matrix xform) { if (p0 == p1) return 0; - return (NR::distance(p0 * xform, p1 * xform) / NR::distance(p0, p1)); + return (Geom::distance(p0 * xform, p1 * xform) / Geom::distance(p0, p1)); } void @@ -415,8 +415,8 @@ sp_rect_set_visible_rx(SPRect *rect, gdouble rx) rect->rx._set = false; } else { rect->rx.computed = rx / vector_stretch( - NR::Point(rect->x.computed + 1, rect->y.computed), - NR::Point(rect->x.computed, rect->y.computed), + Geom::Point(rect->x.computed + 1, rect->y.computed), + Geom::Point(rect->x.computed, rect->y.computed), SP_ITEM(rect)->transform); rect->rx._set = true; } @@ -431,8 +431,8 @@ sp_rect_set_visible_ry(SPRect *rect, gdouble ry) rect->ry._set = false; } else { rect->ry.computed = ry / vector_stretch( - NR::Point(rect->x.computed, rect->y.computed + 1), - NR::Point(rect->x.computed, rect->y.computed), + Geom::Point(rect->x.computed, rect->y.computed + 1), + Geom::Point(rect->x.computed, rect->y.computed), SP_ITEM(rect)->transform); rect->ry._set = true; } @@ -445,8 +445,8 @@ sp_rect_get_visible_rx(SPRect *rect) if (!rect->rx._set) return 0; return rect->rx.computed * vector_stretch( - NR::Point(rect->x.computed + 1, rect->y.computed), - NR::Point(rect->x.computed, rect->y.computed), + Geom::Point(rect->x.computed + 1, rect->y.computed), + Geom::Point(rect->x.computed, rect->y.computed), SP_ITEM(rect)->transform); } @@ -456,21 +456,21 @@ sp_rect_get_visible_ry(SPRect *rect) if (!rect->ry._set) return 0; return rect->ry.computed * vector_stretch( - NR::Point(rect->x.computed, rect->y.computed + 1), - NR::Point(rect->x.computed, rect->y.computed), + Geom::Point(rect->x.computed, rect->y.computed + 1), + Geom::Point(rect->x.computed, rect->y.computed), SP_ITEM(rect)->transform); } void -sp_rect_compensate_rxry(SPRect *rect, NR::Matrix xform) +sp_rect_compensate_rxry(SPRect *rect, Geom::Matrix xform) { if (rect->rx.computed == 0 && rect->ry.computed == 0) return; // nothing to compensate // test unit vectors to find out compensation: - NR::Point c(rect->x.computed, rect->y.computed); - NR::Point cx = c + NR::Point(1, 0); - NR::Point cy = c + NR::Point(0, 1); + Geom::Point c(rect->x.computed, rect->y.computed); + Geom::Point cx = c + Geom::Point(1, 0); + Geom::Point cy = c + Geom::Point(0, 1); // apply previous transform if any c *= SP_ITEM(rect)->transform; @@ -503,8 +503,8 @@ void sp_rect_set_visible_width(SPRect *rect, gdouble width) { rect->width.computed = width / vector_stretch( - NR::Point(rect->x.computed + 1, rect->y.computed), - NR::Point(rect->x.computed, rect->y.computed), + Geom::Point(rect->x.computed + 1, rect->y.computed), + Geom::Point(rect->x.computed, rect->y.computed), SP_ITEM(rect)->transform); rect->width._set = true; SP_OBJECT(rect)->updateRepr(); @@ -514,8 +514,8 @@ void sp_rect_set_visible_height(SPRect *rect, gdouble height) { rect->height.computed = height / vector_stretch( - NR::Point(rect->x.computed, rect->y.computed + 1), - NR::Point(rect->x.computed, rect->y.computed), + Geom::Point(rect->x.computed, rect->y.computed + 1), + Geom::Point(rect->x.computed, rect->y.computed), SP_ITEM(rect)->transform); rect->height._set = true; SP_OBJECT(rect)->updateRepr(); @@ -527,8 +527,8 @@ sp_rect_get_visible_width(SPRect *rect) if (!rect->width._set) return 0; return rect->width.computed * vector_stretch( - NR::Point(rect->x.computed + 1, rect->y.computed), - NR::Point(rect->x.computed, rect->y.computed), + Geom::Point(rect->x.computed + 1, rect->y.computed), + Geom::Point(rect->x.computed, rect->y.computed), SP_ITEM(rect)->transform); } @@ -538,8 +538,8 @@ sp_rect_get_visible_height(SPRect *rect) if (!rect->height._set) return 0; return rect->height.computed * vector_stretch( - NR::Point(rect->x.computed, rect->y.computed + 1), - NR::Point(rect->x.computed, rect->y.computed), + Geom::Point(rect->x.computed, rect->y.computed + 1), + Geom::Point(rect->x.computed, rect->y.computed), SP_ITEM(rect)->transform); } @@ -560,12 +560,12 @@ static void sp_rect_snappoints(SPItem const *item, SnapPointsIter p, Inkscape::S SPRect *rect = SP_RECT(item); - NR::Matrix const i2d (sp_item_i2d_affine (item)); + Geom::Matrix const i2d (sp_item_i2d_affine (item)); - *p = NR::Point(rect->x.computed, rect->y.computed) * i2d; - *p = NR::Point(rect->x.computed, rect->y.computed + rect->height.computed) * i2d; - *p = NR::Point(rect->x.computed + rect->width.computed, rect->y.computed + rect->height.computed) * i2d; - *p = NR::Point(rect->x.computed + rect->width.computed, rect->y.computed) * i2d; + *p = Geom::Point(rect->x.computed, rect->y.computed) * i2d; + *p = Geom::Point(rect->x.computed, rect->y.computed + rect->height.computed) * i2d; + *p = Geom::Point(rect->x.computed + rect->width.computed, rect->y.computed + rect->height.computed) * i2d; + *p = Geom::Point(rect->x.computed + rect->width.computed, rect->y.computed) * i2d; } void @@ -580,12 +580,12 @@ sp_rect_convert_to_guides(SPItem *item) { std::list > pts; - NR::Matrix const i2d (sp_item_i2d_affine(SP_ITEM(rect))); + Geom::Matrix const i2d (sp_item_i2d_affine(SP_ITEM(rect))); - NR::Point A1(NR::Point(rect->x.computed, rect->y.computed) * i2d); - NR::Point A2(NR::Point(rect->x.computed, rect->y.computed + rect->height.computed) * i2d); - NR::Point A3(NR::Point(rect->x.computed + rect->width.computed, rect->y.computed + rect->height.computed) * i2d); - NR::Point A4(NR::Point(rect->x.computed + rect->width.computed, rect->y.computed) * i2d); + 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); pts.push_back(std::make_pair(A1, A2)); pts.push_back(std::make_pair(A2, A3)); diff --git a/src/sp-rect.h b/src/sp-rect.h index 4cf3b24ba..5c6fafab5 100644 --- a/src/sp-rect.h +++ b/src/sp-rect.h @@ -60,6 +60,6 @@ void sp_rect_set_visible_height (SPRect *rect, gdouble ry); gdouble sp_rect_get_visible_width (SPRect *rect); gdouble sp_rect_get_visible_height (SPRect *rect); -void sp_rect_compensate_rxry (SPRect *rect, NR::Matrix xform); +void sp_rect_compensate_rxry (SPRect *rect, Geom::Matrix xform); #endif diff --git a/src/sp-star.cpp b/src/sp-star.cpp index 79bdc4650..bbf808209 100644 --- a/src/sp-star.cpp +++ b/src/sp-star.cpp @@ -101,7 +101,7 @@ static void sp_star_init (SPStar * star) { star->sides = 5; - star->center = NR::Point(0, 0); + star->center = Geom::Point(0, 0); star->r[0] = 1.0; star->r[1] = 0.001; star->arg[0] = star->arg[1] = 0.0; @@ -140,8 +140,8 @@ sp_star_write (SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape::XML if (flags & SP_OBJECT_WRITE_EXT) { repr->setAttribute("sodipodi:type", "star"); sp_repr_set_int (repr, "sodipodi:sides", star->sides); - sp_repr_set_svg_double(repr, "sodipodi:cx", star->center[NR::X]); - sp_repr_set_svg_double(repr, "sodipodi:cy", star->center[NR::Y]); + sp_repr_set_svg_double(repr, "sodipodi:cx", star->center[Geom::X]); + sp_repr_set_svg_double(repr, "sodipodi:cy", star->center[Geom::Y]); sp_repr_set_svg_double(repr, "sodipodi:r1", star->r[0]); sp_repr_set_svg_double(repr, "sodipodi:r2", star->r[1]); sp_repr_set_svg_double(repr, "sodipodi:arg1", star->arg[0]); @@ -181,20 +181,20 @@ sp_star_set (SPObject *object, unsigned int key, const gchar *value) object->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG); break; case SP_ATTR_SODIPODI_CX: - if (!sp_svg_length_read_ldd (value, &unit, NULL, &star->center[NR::X]) || + if (!sp_svg_length_read_ldd (value, &unit, NULL, &star->center[Geom::X]) || (unit == SVGLength::EM) || (unit == SVGLength::EX) || (unit == SVGLength::PERCENT)) { - star->center[NR::X] = 0.0; + star->center[Geom::X] = 0.0; } object->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG); break; case SP_ATTR_SODIPODI_CY: - if (!sp_svg_length_read_ldd (value, &unit, NULL, &star->center[NR::Y]) || + if (!sp_svg_length_read_ldd (value, &unit, NULL, &star->center[Geom::Y]) || (unit == SVGLength::EM) || (unit == SVGLength::EX) || (unit == SVGLength::PERCENT)) { - star->center[NR::Y] = 0.0; + star->center[Geom::Y] = 0.0; } object->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG); break; @@ -316,10 +316,10 @@ sp_star_description (SPItem *item) /** Returns a unit-length vector at 90 degrees to the direction from o to n */ -static NR::Point -rot90_rel (NR::Point o, NR::Point n) +static Geom::Point +rot90_rel (Geom::Point o, Geom::Point n) { - return ((1/NR::L2(n - o)) * NR::Point ((n - o)[NR::Y], (o - n)[NR::X])); + return ((1/Geom::L2(n - o)) * Geom::Point ((n - o)[Geom::Y], (o - n)[Geom::X])); } /** @@ -329,13 +329,13 @@ Obvious (but acceptable for my purposes) limits to uniqueness: - returned value is unchanged when the point is moved by less than 1/1024 of px */ static guint32 -point_unique_int (NR::Point o) +point_unique_int (Geom::Point o) { return ((guint32) 65536 * - (((int) floor (o[NR::X] * 64)) % 1024 + ((int) floor (o[NR::X] * 1024)) % 64) + (((int) floor (o[Geom::X] * 64)) % 1024 + ((int) floor (o[Geom::X] * 1024)) % 64) + - (((int) floor (o[NR::Y] * 64)) % 1024 + ((int) floor (o[NR::Y] * 1024)) % 64) + (((int) floor (o[Geom::Y] * 64)) % 1024 + ((int) floor (o[Geom::Y] * 1024)) % 64) ); } @@ -362,11 +362,11 @@ rnd (guint32 const seed, unsigned steps) { return ( lcg / 4294967296. ) - 0.5; } -static NR::Point +static Geom::Point sp_star_get_curvepoint (SPStar *star, SPStarPoint point, gint index, bool previ) { // the point whose neighboring curve handle we're calculating - NR::Point o = sp_star_get_xy (star, point, index); + Geom::Point o = sp_star_get_xy (star, point, index); // indices of previous and next points gint pi = (index > 0)? (index - 1) : (star->sides - 1); @@ -376,25 +376,25 @@ sp_star_get_curvepoint (SPStar *star, SPStarPoint point, gint index, bool previ) SPStarPoint other = (point == SP_STAR_POINT_KNOT2? SP_STAR_POINT_KNOT1 : SP_STAR_POINT_KNOT2); // the neighbors of o; depending on flatsided, they're either the same type (polygon) or the other type (star) - NR::Point prev = (star->flatsided? sp_star_get_xy (star, point, pi) : sp_star_get_xy (star, other, point == SP_STAR_POINT_KNOT2? index : pi)); - NR::Point next = (star->flatsided? sp_star_get_xy (star, point, ni) : sp_star_get_xy (star, other, point == SP_STAR_POINT_KNOT1? index : ni)); + Geom::Point prev = (star->flatsided? sp_star_get_xy (star, point, pi) : sp_star_get_xy (star, other, point == SP_STAR_POINT_KNOT2? index : pi)); + Geom::Point next = (star->flatsided? sp_star_get_xy (star, point, ni) : sp_star_get_xy (star, other, point == SP_STAR_POINT_KNOT1? index : ni)); // prev-next midpoint - NR::Point mid = 0.5 * (prev + next); + Geom::Point mid = 0.5 * (prev + next); // point to which we direct the bissector of the curve handles; // it's far enough outside the star on the perpendicular to prev-next through mid - NR::Point biss = mid + 100000 * rot90_rel (mid, next); + Geom::Point biss = mid + 100000 * rot90_rel (mid, next); // lengths of vectors to prev and next - gdouble prev_len = NR::L2 (prev - o); - gdouble next_len = NR::L2 (next - o); + gdouble prev_len = Geom::L2 (prev - o); + gdouble next_len = Geom::L2 (next - o); // unit-length vector perpendicular to o-biss - NR::Point rot = rot90_rel (o, biss); + Geom::Point rot = rot90_rel (o, biss); // multiply rot by star->rounded coefficient and the distance to the star point; flip for next - NR::Point ret; + Geom::Point ret; if (previ) { ret = (star->rounded * prev_len) * rot; } else { @@ -409,11 +409,11 @@ sp_star_get_curvepoint (SPStar *star, SPStarPoint point, gint index, bool previ) guint32 seed = point_unique_int (o); // randomly rotate (by step 3 from the seed) and scale (by step 4) the vector - ret = ret * NR::Matrix (Geom::Rotate (star->randomized * M_PI * rnd (seed, 3))); + ret = ret * Geom::Matrix (Geom::Rotate (star->randomized * M_PI * rnd (seed, 3))); ret *= ( 1 + star->randomized * rnd (seed, 4)); // the randomized corner point - NR::Point o_randomized = sp_star_get_xy (star, point, index, true); + Geom::Point o_randomized = sp_star_get_xy (star, point, index, true); return o_randomized + ret; } @@ -507,7 +507,7 @@ sp_star_set_shape (SPShape *shape) } void -sp_star_position_set (SPStar *star, gint sides, NR::Point center, gdouble r1, gdouble r2, gdouble arg1, gdouble arg2, bool isflat, double rounded, double randomized) +sp_star_position_set (SPStar *star, gint sides, Geom::Point center, gdouble r1, gdouble r2, gdouble arg1, gdouble arg2, bool isflat, double rounded, double randomized) { g_return_if_fail (star != NULL); g_return_if_fail (SP_IS_STAR (star)); @@ -548,7 +548,7 @@ static void sp_star_snappoints(SPItem const *item, SnapPointsIter p, Inkscape::S * Initial item coordinate system is same as document coordinate system. */ -NR::Point +Geom::Point sp_star_get_xy (SPStar *star, SPStarPoint point, gint index, bool randomized) { gdouble darg = 2.0 * M_PI / (double) star->sides; @@ -556,7 +556,7 @@ sp_star_get_xy (SPStar *star, SPStarPoint point, gint index, bool randomized) double arg = star->arg[point]; arg += index * darg; - NR::Point xy = star->r[point] * NR::Point(cos(arg), sin(arg)) + star->center; + Geom::Point xy = star->r[point] * Geom::Point(cos(arg), sin(arg)) + star->center; if (!randomized || star->randomized == 0) { // return the exact point @@ -567,7 +567,7 @@ sp_star_get_xy (SPStar *star, SPStarPoint point, gint index, bool randomized) // the full range (corresponding to star->randomized == 1.0) is equal to the star's diameter double range = 2 * MAX (star->r[0], star->r[1]); // find out the random displacement; x is controlled by step 1 from the seed, y by the step 2 - NR::Point shift (star->randomized * range * rnd (seed, 1), star->randomized * range * rnd (seed, 2)); + Geom::Point shift (star->randomized * range * rnd (seed, 1), star->randomized * range * rnd (seed, 2)); // add the shift to the exact point return xy + shift; } diff --git a/src/sp-star.h b/src/sp-star.h index f6b70df22..82197d13d 100644 --- a/src/sp-star.h +++ b/src/sp-star.h @@ -35,7 +35,7 @@ typedef enum { struct SPStar : public SPPolygon { gint sides; - NR::Point center; + Geom::Point center; double r[2]; double arg[2]; bool flatsided; @@ -50,9 +50,9 @@ struct SPStarClass { GType sp_star_get_type (void); -void sp_star_position_set (SPStar *star, gint sides, NR::Point center, gdouble r1, gdouble r2, gdouble arg1, gdouble arg2, bool isflat, double rounded, double randomized); +void sp_star_position_set (SPStar *star, gint sides, Geom::Point center, gdouble r1, gdouble r2, gdouble arg1, gdouble arg2, bool isflat, double rounded, double randomized); -NR::Point sp_star_get_xy (SPStar *star, SPStarPoint point, gint index, bool randomized = false); +Geom::Point sp_star_get_xy (SPStar *star, SPStarPoint point, gint index, bool randomized = false); diff --git a/src/sp-text.cpp b/src/sp-text.cpp index 6c2a5264a..9266297be 100644 --- a/src/sp-text.cpp +++ b/src/sp-text.cpp @@ -249,7 +249,7 @@ sp_text_update (SPObject *object, SPCtx *ctx, guint flags) text->rebuildLayout(); NRRect paintbox; - sp_item_invoke_bbox(text, &paintbox, NR::identity(), TRUE); + sp_item_invoke_bbox(text, &paintbox, Geom::identity(), TRUE); for (SPItemView* v = text->display; v != NULL; v = v->next) { text->_clearFlow(NR_ARENA_GROUP(v->arenaitem)); nr_arena_group_set_style(NR_ARENA_GROUP(v->arenaitem), SP_OBJECT_STYLE(object)); @@ -275,7 +275,7 @@ sp_text_modified (SPObject *object, guint flags) if (flags & ( SP_OBJECT_STYLE_MODIFIED_FLAG )) { SPText *text = SP_TEXT (object); NRRect paintbox; - sp_item_invoke_bbox(text, &paintbox, NR::identity(), TRUE); + sp_item_invoke_bbox(text, &paintbox, Geom::identity(), TRUE); for (SPItemView* v = text->display; v != NULL; v = v->next) { text->_clearFlow(NR_ARENA_GROUP(v->arenaitem)); nr_arena_group_set_style(NR_ARENA_GROUP(v->arenaitem), SP_OBJECT_STYLE(object)); @@ -387,7 +387,7 @@ sp_text_show(SPItem *item, NRArena *arena, unsigned /* key*/, unsigned /*flags*/ // pass the bbox of the text object as paintbox (used for paintserver fills) NRRect paintbox; - sp_item_invoke_bbox(item, &paintbox, NR::identity(), TRUE); + sp_item_invoke_bbox(item, &paintbox, Geom::identity(), TRUE); group->layout.show(flowed, &paintbox); return flowed; @@ -492,13 +492,13 @@ sp_text_print (SPItem *item, SPPrintContext *ctx) NRRect pbox, dbox, bbox; SPText *group = SP_TEXT (item); - sp_item_invoke_bbox(item, &pbox, NR::identity(), TRUE); + sp_item_invoke_bbox(item, &pbox, Geom::identity(), TRUE); sp_item_bbox_desktop (item, &bbox); dbox.x0 = 0.0; dbox.y0 = 0.0; dbox.x1 = sp_document_width (SP_OBJECT_DOCUMENT (item)); dbox.y1 = sp_document_height (SP_OBJECT_DOCUMENT (item)); - NR::Matrix const ctm (sp_item_i2d_affine(item)); + Geom::Matrix const ctm (sp_item_i2d_affine(item)); group->layout.print(ctx,&pbox,&dbox,&bbox,ctm); } @@ -617,7 +617,7 @@ void SPText::_adjustFontsizeRecursive(SPItem *item, double ex, bool is_root) } } -void SPText::_adjustCoordsRecursive(SPItem *item, NR::Matrix const &m, double ex, bool is_root) +void SPText::_adjustCoordsRecursive(SPItem *item, Geom::Matrix const &m, double ex, bool is_root) { if (SP_IS_TSPAN(item)) SP_TSPAN(item)->attributes.transform(m, ex, ex, is_root); @@ -891,9 +891,9 @@ void TextTagAttributes::transform(Geom::Matrix const &matrix, double scale_x, do if (extend_zero_length && points_count < 1) points_count = 1; for (unsigned i = 0 ; i < points_count ; i++) { - NR::Point point; + Geom::Point point; if (i < attributes.x.size()) point[Geom::X] = attributes.x[i].computed; - else point[NR::X] = 0.0; + else point[Geom::X] = 0.0; if (i < attributes.y.size()) point[Geom::Y] = attributes.y[i].computed; else point[Geom::Y] = 0.0; point *= matrix; diff --git a/src/sp-text.h b/src/sp-text.h index 5c62e3c8b..d9b153925 100644 --- a/src/sp-text.h +++ b/src/sp-text.h @@ -53,7 +53,7 @@ struct SPText : public SPItem { extend zero-length position vectors to length 1 in order to record the new position. This is necessary to convert from objects whose position is completely specified by transformations. */ - static void _adjustCoordsRecursive(SPItem *item, NR::Matrix const &m, double ex, bool is_root = true); + static void _adjustCoordsRecursive(SPItem *item, Geom::Matrix const &m, double ex, bool is_root = true); static void _adjustFontsizeRecursive(SPItem *item, double ex, bool is_root = true); /** discards the NRArena objects representing this text. */ diff --git a/src/sp-use.cpp b/src/sp-use.cpp index 91b90502a..134588e65 100644 --- a/src/sp-use.cpp +++ b/src/sp-use.cpp @@ -64,7 +64,7 @@ static void sp_use_delete_self(SPObject *deleted, SPUse *self); static SPItemClass *parent_class; -//void m_print(gchar *say, NR::Matrix m) +//void m_print(gchar *say, Geom::Matrix m) //{ g_print("%s %g %g %g %g %g %g\n", say, m[0], m[1], m[2], m[3], m[4], m[5]); } GType @@ -299,7 +299,7 @@ sp_use_print(SPItem *item, SPPrintContext *ctx) SPUse *use = SP_USE(item); if ((use->x._set && use->x.computed != 0) || (use->y._set && use->y.computed != 0)) { - NR::Matrix tp(Geom::Translate(use->x.computed, use->y.computed)); + Geom::Matrix tp(Geom::Translate(use->x.computed, use->y.computed)); sp_print_bind(ctx, tp, 1.0); translated = true; } @@ -399,7 +399,7 @@ sp_use_root(SPUse *use) * Returns the effective transform that goes from the ultimate original to given SPUse, both ends * included. */ -NR::Matrix +Geom::Matrix sp_use_get_root_transform(SPUse *use) { //track the ultimate source of a chain of uses @@ -414,7 +414,7 @@ sp_use_get_root_transform(SPUse *use) //calculate the accummulated transform, starting from the original - NR::Matrix t(NR::identity()); + Geom::Matrix t(Geom::identity()); for (GSList *i = chain; i != NULL; i = i->next) { SPItem *i_tem = SP_ITEM(i->data); @@ -439,7 +439,7 @@ sp_use_get_root_transform(SPUse *use) * Returns the transform that leads to the use from its immediate original. * Does not inlcude the original's transform if any. */ -NR::Matrix +Geom::Matrix sp_use_get_parent_transform(SPUse *use) { Geom::Matrix t(Geom::identity()); @@ -605,7 +605,7 @@ sp_use_update(SPObject *object, SPCtx *ctx, unsigned flags) cctx.vp.y0 = 0.0; cctx.vp.x1 = use->width.computed; cctx.vp.y1 = use->height.computed; - cctx.i2vp = NR::identity(); + cctx.i2vp = Geom::identity(); flags&=~SP_OBJECT_USER_MODIFIED_FLAG_B; if (use->child) { @@ -625,7 +625,7 @@ sp_use_update(SPObject *object, SPCtx *ctx, unsigned flags) /* As last step set additional transform of arena group */ for (SPItemView *v = item->display; v != NULL; v = v->next) { - NR::Matrix t(Geom::Translate(use->x.computed, use->y.computed)); + Geom::Matrix t(Geom::Translate(use->x.computed, use->y.computed)); nr_arena_group_set_child_transform(NR_ARENA_GROUP(v->arenaitem), t); } } diff --git a/src/sp-use.h b/src/sp-use.h index a8f2745ab..c5c07158f 100644 --- a/src/sp-use.h +++ b/src/sp-use.h @@ -59,8 +59,8 @@ GType sp_use_get_type (void); SPItem *sp_use_unlink (SPUse *use); SPItem *sp_use_get_original (SPUse *use); -NR::Matrix sp_use_get_parent_transform (SPUse *use); -NR::Matrix sp_use_get_root_transform(SPUse *use); +Geom::Matrix sp_use_get_parent_transform (SPUse *use); +Geom::Matrix sp_use_get_root_transform(SPUse *use); SPItem *sp_use_root(SPUse *use); #endif diff --git a/src/star-context.cpp b/src/star-context.cpp index 6bb0a6f2d..a18170346 100644 --- a/src/star-context.cpp +++ b/src/star-context.cpp @@ -54,7 +54,7 @@ static void sp_star_context_setup (SPEventContext *ec); static void sp_star_context_set (SPEventContext *ec, Inkscape::Preferences::Entry *val); static gint sp_star_context_root_handler (SPEventContext *ec, GdkEvent *event); -static void sp_star_drag (SPStarContext * sc, NR::Point p, guint state); +static void sp_star_drag (SPStarContext * sc, Geom::Point p, guint state); static void sp_star_finish (SPStarContext * sc); static SPEventContextClass * parent_class; @@ -308,8 +308,8 @@ static gint sp_star_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_star_drag (sc, motion_dt, event->motion.state); @@ -421,7 +421,7 @@ static gint sp_star_context_root_handler(SPEventContext *event_context, GdkEvent return ret; } -static void sp_star_drag(SPStarContext *sc, NR::Point p, guint state) +static void sp_star_drag(SPStarContext *sc, Geom::Point p, guint state) { SPDesktop *desktop = SP_EVENT_CONTEXT(sc)->desktop; diff --git a/src/star-context.h b/src/star-context.h index 37a7f587c..6db29ec42 100644 --- a/src/star-context.h +++ b/src/star-context.h @@ -29,7 +29,7 @@ class SPStarContextClass; struct SPStarContext : public SPEventContext { SPItem *item; - NR::Point center; + Geom::Point center; /* Number of corners */ gint magnitude; diff --git a/src/text-editing.cpp b/src/text-editing.cpp index 231d834ca..482f6faeb 100644 --- a/src/text-editing.cpp +++ b/src/text-editing.cpp @@ -943,7 +943,7 @@ text_tag_attributes_at_position(SPItem *item, Inkscape::Text::Layout::iterator c } void -sp_te_adjust_kerning_screen (SPItem *item, Inkscape::Text::Layout::iterator const &start, Inkscape::Text::Layout::iterator const &end, SPDesktop *desktop, NR::Point by) +sp_te_adjust_kerning_screen (SPItem *item, Inkscape::Text::Layout::iterator const &start, Inkscape::Text::Layout::iterator const &end, SPDesktop *desktop, Geom::Point by) { // divide increment by zoom // divide increment by matrix expansion @@ -1094,7 +1094,7 @@ sp_te_get_average_linespacing (SPItem *text) return 0; unsigned line_count = layout->lineIndex(layout->end()); - double all_lines_height = layout->characterAnchorPoint(layout->end())[NR::Y] - layout->characterAnchorPoint(layout->begin())[NR::Y]; + double all_lines_height = layout->characterAnchorPoint(layout->end())[Geom::Y] - layout->characterAnchorPoint(layout->begin())[Geom::Y]; double average_line_height = all_lines_height / (line_count == 0 ? 1 : line_count); return average_line_height; } @@ -1118,7 +1118,7 @@ sp_te_adjust_linespacing_screen (SPItem *text, Inkscape::Text::Layout::iterator } unsigned line_count = layout->lineIndex(layout->end()); - double all_lines_height = layout->characterAnchorPoint(layout->end())[NR::Y] - layout->characterAnchorPoint(layout->begin())[NR::Y]; + double all_lines_height = layout->characterAnchorPoint(layout->end())[Geom::Y] - layout->characterAnchorPoint(layout->begin())[Geom::Y]; double average_line_height = all_lines_height / (line_count == 0 ? 1 : line_count); if (fabs(average_line_height) < 0.001) average_line_height = 0.001; diff --git a/src/text-editing.h b/src/text-editing.h index bdb6664ee..b1fb6b200 100644 --- a/src/text-editing.h +++ b/src/text-editing.h @@ -50,7 +50,7 @@ gchar *sp_te_get_string_multiline(SPItem const *text); Glib::ustring sp_te_get_string_multiline(SPItem const *text, Inkscape::Text::Layout::iterator const &start, Inkscape::Text::Layout::iterator const &end); void sp_te_set_repr_text_multiline(SPItem *text, gchar const *str); -void sp_te_adjust_kerning_screen(SPItem *text, Inkscape::Text::Layout::iterator const &start, Inkscape::Text::Layout::iterator const &end, SPDesktop *desktop, NR::Point by); +void sp_te_adjust_kerning_screen(SPItem *text, Inkscape::Text::Layout::iterator const &start, Inkscape::Text::Layout::iterator const &end, SPDesktop *desktop, Geom::Point by); void sp_te_adjust_rotation_screen(SPItem *text, Inkscape::Text::Layout::iterator const &start, Inkscape::Text::Layout::iterator const &end, SPDesktop *desktop, gdouble pixels); void sp_te_adjust_rotation(SPItem *text, Inkscape::Text::Layout::iterator const &start, Inkscape::Text::Layout::iterator const &end, SPDesktop *desktop, gdouble degrees); -- 2.30.2