summaryrefslogtreecommitdiffstats
path: root/src/sp-guide.cpp
diff options
context:
space:
mode:
authorMarkus Engel <markus.engel@tum.de>2013-07-31 23:06:31 +0000
committerMarkus Engel <markus.engel@tum.de>2013-07-31 23:06:31 +0000
commit49c324545e713c1ca375b7e559418e02ebe52945 (patch)
treeb1fa48caaa5446f49c09a1d73d48730893fbf8b0 /src/sp-guide.cpp
parentRemoved placement news / explicit destructor calls. (diff)
downloadinkscape-49c324545e713c1ca375b7e559418e02ebe52945.tar.gz
inkscape-49c324545e713c1ca375b7e559418e02ebe52945.zip
Replacement of unnecessary variables.
(bzr r11608.1.114)
Diffstat (limited to 'src/sp-guide.cpp')
-rw-r--r--src/sp-guide.cpp56
1 files changed, 24 insertions, 32 deletions
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: