summaryrefslogtreecommitdiffstats
path: root/src/sp-ellipse.cpp
diff options
context:
space:
mode:
authorMarkus Engel <markus.engel@tum.de>2013-09-24 22:17:24 +0000
committerMarkus Engel <markus.engel@tum.de>2013-09-24 22:17:24 +0000
commitbcca22a25ae98f70c36fff6292f0a8fe4e578d89 (patch)
treea18d382d32f471b7119b9b7b2782cec04d6da43f /src/sp-ellipse.cpp
parentRefactored SPUse. (diff)
parentFix my email address through codebase (diff)
downloadinkscape-bcca22a25ae98f70c36fff6292f0a8fe4e578d89.tar.gz
inkscape-bcca22a25ae98f70c36fff6292f0a8fe4e578d89.zip
Merged from trunk (r12588).
(bzr r11608.1.129)
Diffstat (limited to 'src/sp-ellipse.cpp')
-rw-r--r--src/sp-ellipse.cpp69
1 files changed, 61 insertions, 8 deletions
diff --git a/src/sp-ellipse.cpp b/src/sp-ellipse.cpp
index a3e1a475a..09b99dad1 100644
--- a/src/sp-ellipse.cpp
+++ b/src/sp-ellipse.cpp
@@ -322,6 +322,59 @@ void SPGenericEllipse::snappoints(std::vector<Inkscape::SnapCandidatePoint> &p,
}
}
+Geom::Affine SPGenericEllipse::set_transform(Geom::Affine const &xform)
+{
+ /* Calculate ellipse start in parent coords. */
+ Geom::Point pos( Geom::Point(this->cx.computed, this->cy.computed) * xform );
+
+ /* This function takes care of translation and scaling, we return whatever parts we can't
+ handle. */
+ Geom::Affine ret(Geom::Affine(xform).withoutTranslation());
+ gdouble const sw = hypot(ret[0], ret[1]);
+ gdouble const sh = hypot(ret[2], ret[3]);
+ if (sw > 1e-9) {
+ ret[0] /= sw;
+ ret[1] /= sw;
+ } else {
+ ret[0] = 1.0;
+ ret[1] = 0.0;
+ }
+ if (sh > 1e-9) {
+ ret[2] /= sh;
+ ret[3] /= sh;
+ } else {
+ ret[2] = 0.0;
+ ret[3] = 1.0;
+ }
+
+ if (this->rx._set) {
+ this->rx = this->rx.computed * sw;
+ }
+ if (this->ry._set) {
+ this->ry = this->ry.computed * sh;
+ }
+
+ /* Find start in item coords */
+ pos = pos * ret.inverse();
+ this->cx = pos[Geom::X];
+ this->cy = pos[Geom::Y];
+
+ this->set_shape();
+
+ // Adjust stroke width
+ this->adjust_stroke(sqrt(fabs(sw * sh)));
+
+ // Adjust pattern fill
+ this->adjust_pattern(xform * ret.inverse());
+
+ // Adjust gradient fill
+ this->adjust_gradient(xform * ret.inverse());
+
+ this->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_STYLE_MODIFIED_FLAG);
+
+ return ret;
+}
+
void
sp_genericellipse_normalize(SPGenericEllipse *ellipse)
{
@@ -431,8 +484,8 @@ void SPEllipse::set(unsigned int key, gchar const* value) {
}
}
-gchar* SPEllipse::description() {
- return g_strdup(_("<b>Ellipse</b>"));
+const char* SPEllipse::displayName() {
+ return _("Ellipse");
}
@@ -511,8 +564,8 @@ void SPCircle::set(unsigned int key, gchar const* value) {
}
}
-gchar* SPCircle::description() {
- return g_strdup(_("<b>Circle</b>"));
+const char* SPCircle::displayName() {
+ return _("Circle");
}
/* <path sodipodi:type="arc"> element */
@@ -685,7 +738,7 @@ void SPArc::modified(guint flags) {
}
-gchar* SPArc::description() {
+const char* SPArc::displayName() {
gdouble len = fmod(this->end - this->start, SP_2PI);
if (len < 0.0) {
@@ -694,12 +747,12 @@ gchar* SPArc::description() {
if (!(fabs(len) < 1e-8 || fabs(len - SP_2PI) < 1e-8)) {
if (this->closed) {
- return g_strdup(_("<b>Segment</b>"));
+ return _("Segment");
} else {
- return g_strdup(_("<b>Arc</b>"));
+ return _("Arc");
}
} else {
- return g_strdup(_("<b>Ellipse</b>"));
+ return _("Ellipse");
}
}