From 49c324545e713c1ca375b7e559418e02ebe52945 Mon Sep 17 00:00:00 2001 From: Markus Engel Date: Thu, 1 Aug 2013 01:06:31 +0200 Subject: Replacement of unnecessary variables. (bzr r11608.1.114) --- src/sp-guide.cpp | 56 ++++++++++++++++++++++++-------------------------------- 1 file changed, 24 insertions(+), 32 deletions(-) (limited to 'src/sp-guide.cpp') diff --git a/src/sp-guide.cpp b/src/sp-guide.cpp index 4fc6e34bb..b0f4aab49 100644 --- a/src/sp-guide.cpp +++ b/src/sp-guide.cpp @@ -139,54 +139,46 @@ static void sp_guide_get_property(GObject *object, guint prop_id, GValue *value, void SPGuide::build(SPDocument *document, Inkscape::XML::Node *repr) { SPObject::build(document, repr); - SPGuide* object = this; - - object->readAttr( "inkscape:label" ); - object->readAttr( "orientation" ); - object->readAttr( "position" ); + this->readAttr( "inkscape:label" ); + this->readAttr( "orientation" ); + this->readAttr( "position" ); /* Register */ - document->addResource("guide", object); + document->addResource("guide", this); } void SPGuide::release() { - SPGuide* object = this; - SPGuide *guide = (SPGuide *) object; - - while (guide->views) { - sp_guideline_delete(SP_GUIDELINE(guide->views->data)); - guide->views = g_slist_remove(guide->views, guide->views->data); + while (this->views) { + sp_guideline_delete(SP_GUIDELINE(this->views->data)); + this->views = g_slist_remove(this->views, this->views->data); } - if (object->document) { + if (this->document) { // Unregister ourselves - object->document->removeResource("guide", object); + this->document->removeResource("guide", this); } SPObject::release(); } void SPGuide::set(unsigned int key, const gchar *value) { - SPGuide* object = this; - SPGuide *guide = SP_GUIDE(object); - switch (key) { case SP_ATTR_INKSCAPE_LABEL: if (value) { - guide->label = g_strdup(value); + this->label = g_strdup(value); } else { - guide->label = NULL; + this->label = NULL; } - sp_guide_set_label(*guide, guide->label, false); + sp_guide_set_label(*this, this->label, false); break; case SP_ATTR_ORIENTATION: { if (value && !strcmp(value, "horizontal")) { /* Visual representation of a horizontal line, constrain vertically (y coordinate). */ - guide->normal_to_line = Geom::Point(0., 1.); + this->normal_to_line = Geom::Point(0., 1.); } else if (value && !strcmp(value, "vertical")) { - guide->normal_to_line = Geom::Point(1., 0.); + this->normal_to_line = Geom::Point(1., 0.); } else if (value) { gchar ** strarray = g_strsplit(value, ",", 2); double newx, newy; @@ -196,16 +188,16 @@ void SPGuide::set(unsigned int key, const gchar *value) { if (success == 2 && (fabs(newx) > 1e-6 || fabs(newy) > 1e-6)) { Geom::Point direction(newx, newy); direction.normalize(); - guide->normal_to_line = direction; + this->normal_to_line = direction; } else { // default to vertical line for bad arguments - guide->normal_to_line = Geom::Point(1., 0.); + this->normal_to_line = Geom::Point(1., 0.); } } else { // default to vertical line for bad arguments - guide->normal_to_line = Geom::Point(1., 0.); + this->normal_to_line = Geom::Point(1., 0.); } - sp_guide_set_normal(*guide, guide->normal_to_line, false); + sp_guide_set_normal(*this, this->normal_to_line, false); } break; case SP_ATTR_POSITION: @@ -217,23 +209,23 @@ void SPGuide::set(unsigned int key, const gchar *value) { success += sp_svg_number_read_d(strarray[1], &newy); g_strfreev (strarray); if (success == 2) { - guide->point_on_line = Geom::Point(newx, newy); + this->point_on_line = Geom::Point(newx, newy); } else if (success == 1) { // before 0.46 style guideline definition. - const gchar *attr = object->getRepr()->attribute("orientation"); + const gchar *attr = this->getRepr()->attribute("orientation"); if (attr && !strcmp(attr, "horizontal")) { - guide->point_on_line = Geom::Point(0, newx); + this->point_on_line = Geom::Point(0, newx); } else { - guide->point_on_line = Geom::Point(newx, 0); + this->point_on_line = Geom::Point(newx, 0); } } } else { // default to (0,0) for bad arguments - guide->point_on_line = Geom::Point(0,0); + this->point_on_line = Geom::Point(0,0); } // update position in non-committing way // fixme: perhaps we need to add an update method instead, and request_update here - sp_guide_moveto(*guide, guide->point_on_line, false); + sp_guide_moveto(*this, this->point_on_line, false); } break; default: -- cgit v1.2.3