summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 1916e71)
raw | patch | inline | side by side (parent: 1916e71)
author | verbalshadow <verbalshadow@users.sourceforge.net> | |
Thu, 4 Dec 2008 01:28:36 +0000 (01:28 +0000) | ||
committer | verbalshadow <verbalshadow@users.sourceforge.net> | |
Thu, 4 Dec 2008 01:28:36 +0000 (01:28 +0000) |
14 files changed:
src/sp-offset.cpp | patch | blob | history | |
src/sp-offset.h | patch | blob | history | |
src/sp-rect.cpp | patch | blob | history | |
src/sp-rect.h | patch | blob | history | |
src/sp-star.cpp | patch | blob | history | |
src/sp-star.h | patch | blob | history | |
src/sp-text.cpp | patch | blob | history | |
src/sp-text.h | patch | blob | history | |
src/sp-use.cpp | patch | blob | history | |
src/sp-use.h | patch | blob | history | |
src/star-context.cpp | patch | blob | history | |
src/star-context.h | patch | blob | history | |
src/text-editing.cpp | patch | blob | history | |
src/text-editing.h | patch | blob | history |
diff --git a/src/sp-offset.cpp b/src/sp-offset.cpp
index faa2cf4575fdb05ca4f35dd0e24899c7c6f84ddf..39b8227a4384cb68cab7508135de9263b97c66bc 100644 (file)
--- a/src/sp-offset.cpp
+++ b/src/sp-offset.cpp
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));
* '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)
{
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;
do
{
// one angle
- NR::Point prx, nex;
+ Geom::Point prx, nex;
prx = theRes->getEdge(pb).dx;
nlen = sqrt (dot(prx, prx));
prx /= nlen;
// 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 0e1a9d4e54a13729daee25d11c50aca5b8c848fe..caecdb1beca9f8a2f9e49c9910b2cdac267f29c0 100644 (file)
--- a/src/sp-offset.h
+++ b/src/sp-offset.h
/// for interactive setting of the radius
bool knotSet;
- NR::Point knot;
+ Geom::Point knot;
bool sourceDirty;
bool isUpdating;
/* 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 ab0ea3d72795a652038f2009b8512f2244a1326f..c568b44be7479f200f7ec54c1f9a5b3f08160c52 100644 (file)
--- a/src/sp-rect.cpp
+++ b/src/sp-rect.cpp
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;
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
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;
}
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;
}
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);
}
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;
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();
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();
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);
}
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
std::list<std::pair<Geom::Point, Geom::Point> > 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 4cf3b24ba07994d03559e3cd5f56251fc72c0284..5c6fafab542c2c9cdc4f1841fd0ef1502513be43 100644 (file)
--- a/src/sp-rect.h
+++ b/src/sp-rect.h
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 79bdc46502a2f8b9277658c72977098a63e79001..bbf8082096b50b0d6d283a4f9ea701c89a9077ef 100644 (file)
--- a/src/sp-star.cpp
+++ b/src/sp-star.cpp
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]);
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;
/**
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]));
}
/**
- 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)
);
}
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;
}
}
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;
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
// 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 f6b70df228704f10d28bfa966afe81d8d05fbd13..82197d13debfc604a50a2628fea1f75e7ce2c6fd 100644 (file)
--- a/src/sp-star.h
+++ b/src/sp-star.h
struct SPStar : public SPPolygon {
gint sides;
- NR::Point center;
+ Geom::Point center;
double r[2];
double arg[2];
bool flatsided;
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 6c2a5264a979223c73e031954052a362273dfdfe..9266297bef3772cb622d0612f58fcbb97e5a7df9 100644 (file)
--- a/src/sp-text.cpp
+++ b/src/sp-text.cpp
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));
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;
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);
}
}
}
-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 5c62e3c8b50ecae0e6649882796eec6a179127e1..d9b15392532ae1ad721ba27eb5482d64225c61fd 100644 (file)
--- a/src/sp-text.h
+++ b/src/sp-text.h
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 91b90502a260699040f042be79adfa40b9c0a70f..134588e659c78071a68ec9859e01c71f75c9ca85 100644 (file)
--- a/src/sp-use.cpp
+++ b/src/sp-use.cpp
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
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;
}
* 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
//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);
* 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());
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) {
/* 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 a8f2745ab5dde32e51e10b22dfaec372d29ee2b0..c5c07158f99f5a19086b4aab369262da13518e5c 100644 (file)
--- a/src/sp-use.h
+++ b/src/sp-use.h
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 6bb0a6f2d50e5874712f9275674b64a66e00cf1e..a18170346de17cef9e7c87d445348e8cc7e968c7 100644 (file)
--- a/src/star-context.cpp
+++ b/src/star-context.cpp
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 37a7f587cdffa63fe8f9c4fa191c791bc40eabcc..6db29ec4212abd32558644fd3b9524fcc4fca0e8 100644 (file)
--- a/src/star-context.h
+++ b/src/star-context.h
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 231d834cafc5c3d577d9359271a4fe4f8e37768d..482f6faebec07e79a5f52e65007dc32a6ac45d2d 100644 (file)
--- 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
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 bdb6664eed0f40557c2b009587b06a3f43f2a811..b1fb6b200b04ce46d4408696cae774735f216354 100644 (file)
--- a/src/text-editing.h
+++ b/src/text-editing.h
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);