summaryrefslogtreecommitdiffstats
path: root/src/object-edit.cpp
diff options
context:
space:
mode:
authorJabier Arraiza Cenoz <jabier.arraiza@marker.es>2013-10-02 22:35:52 +0000
committerJabiertxof <jtx@jtx.marker.es>2013-10-02 22:35:52 +0000
commit9240dbde4547c7e7529f31645ea916faae72bafa (patch)
tree82c7e2e222dd3bd92dea9a21ed60c0479f0149b8 /src/object-edit.cpp
parentupdate to trunk (diff)
parentFix segment welding in the node tool hanging when a two-point segment (diff)
downloadinkscape-9240dbde4547c7e7529f31645ea916faae72bafa.tar.gz
inkscape-9240dbde4547c7e7529f31645ea916faae72bafa.zip
update to trunk
(bzr r12588.1.10)
Diffstat (limited to 'src/object-edit.cpp')
-rw-r--r--src/object-edit.cpp54
1 files changed, 26 insertions, 28 deletions
diff --git a/src/object-edit.cpp b/src/object-edit.cpp
index 25bc62a7f..28786bf66 100644
--- a/src/object-edit.cpp
+++ b/src/object-edit.cpp
@@ -785,24 +785,23 @@ sp_genericellipse_side(SPGenericEllipse *ellipse, Geom::Point const &p)
void
ArcKnotHolderEntityStart::knot_set(Geom::Point const &p, Geom::Point const &/*origin*/, guint state)
{
- Inkscape::Preferences *prefs = Inkscape::Preferences::get();
- int snaps = prefs->getInt("/options/rotationsnapsperpi/value", 12);
+ int snaps = Inkscape::Preferences::get()->getInt("/options/rotationsnapsperpi/value", 12);
- SPGenericEllipse *ge = SP_GENERICELLIPSE(item);
SPArc *arc = SP_ARC(item);
- ge->closed = (sp_genericellipse_side(ge, p) == -1) ? TRUE : FALSE;
+ arc->setClosed(sp_genericellipse_side(arc, p) == -1);
- Geom::Point delta = p - Geom::Point(ge->cx.computed, ge->cy.computed);
- Geom::Scale sc(ge->rx.computed, ge->ry.computed);
- ge->start = atan2(delta * sc.inverse());
- if ( ( state & GDK_CONTROL_MASK )
- && snaps )
- {
- ge->start = sp_round(ge->start, M_PI/snaps);
+ Geom::Point delta = p - Geom::Point(arc->cx.computed, arc->cy.computed);
+ Geom::Scale sc(arc->rx.computed, arc->ry.computed);
+
+ arc->start = atan2(delta * sc.inverse());
+
+ if ((state & GDK_CONTROL_MASK) && snaps) {
+ arc->start = sp_round(arc->start, M_PI / snaps);
}
- sp_genericellipse_normalize(ge);
- (static_cast<SPObject *>(arc))->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG);
+
+ arc->normalize();
+ arc->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG);
}
Geom::Point
@@ -811,7 +810,7 @@ ArcKnotHolderEntityStart::knot_get() const
SPGenericEllipse const *ge = SP_GENERICELLIPSE(item);
SPArc *arc = SP_ARC(item);
- return sp_arc_get_xy(arc, ge->start);
+ return arc->getPointAtAngle(ge->start);
}
void
@@ -828,24 +827,23 @@ ArcKnotHolderEntityStart::knot_click(guint state)
void
ArcKnotHolderEntityEnd::knot_set(Geom::Point const &p, Geom::Point const &/*origin*/, guint state)
{
- Inkscape::Preferences *prefs = Inkscape::Preferences::get();
- int snaps = prefs->getInt("/options/rotationsnapsperpi/value", 12);
+ int snaps = Inkscape::Preferences::get()->getInt("/options/rotationsnapsperpi/value", 12);
- SPGenericEllipse *ge = SP_GENERICELLIPSE(item);
SPArc *arc = SP_ARC(item);
- ge->closed = (sp_genericellipse_side(ge, p) == -1) ? TRUE : FALSE;
+ arc->setClosed(sp_genericellipse_side(arc, p) == -1);
- Geom::Point delta = p - Geom::Point(ge->cx.computed, ge->cy.computed);
- Geom::Scale sc(ge->rx.computed, ge->ry.computed);
- ge->end = atan2(delta * sc.inverse());
- if ( ( state & GDK_CONTROL_MASK )
- && snaps )
- {
- ge->end = sp_round(ge->end, M_PI/snaps);
+ Geom::Point delta = p - Geom::Point(arc->cx.computed, arc->cy.computed);
+ Geom::Scale sc(arc->rx.computed, arc->ry.computed);
+
+ arc->end = atan2(delta * sc.inverse());
+
+ if ((state & GDK_CONTROL_MASK) && snaps) {
+ arc->end = sp_round(arc->end, M_PI/snaps);
}
- sp_genericellipse_normalize(ge);
- (static_cast<SPObject *>(arc))->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG);
+
+ arc->normalize();
+ arc->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG);
}
Geom::Point
@@ -854,7 +852,7 @@ ArcKnotHolderEntityEnd::knot_get() const
SPGenericEllipse const *ge = SP_GENERICELLIPSE(item);
SPArc *arc = SP_ARC(item);
- return sp_arc_get_xy(arc, ge->end);
+ return arc->getPointAtAngle(ge->end);
}