summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJohan B. C. Engelen <jbc.engelen@swissonline.ch>2011-07-19 18:24:59 +0000
committerJohan Engelen <goejendaagh@zonnet.nl>2011-07-19 18:24:59 +0000
commit97b1c4d688a979eb8e327c13c6bcc6fad20902f2 (patch)
tree2c2c73c29be8911a89a752136c25d65b9abd5684 /src
parentBuild depends on Cairo 1.10 or higher (diff)
downloadinkscape-97b1c4d688a979eb8e327c13c6bcc6fad20902f2.tar.gz
inkscape-97b1c4d688a979eb8e327c13c6bcc6fad20902f2.zip
remove some unnecessary inkscape_active_desktop() calls
(bzr r10477)
Diffstat (limited to 'src')
-rw-r--r--src/box3d.cpp2
-rw-r--r--src/sp-guide.cpp14
-rw-r--r--src/sp-guide.h4
-rw-r--r--src/sp-item.cpp5
-rw-r--r--src/sp-line.cpp2
-rw-r--r--src/sp-path.cpp2
-rw-r--r--src/sp-rect.cpp2
7 files changed, 15 insertions, 16 deletions
diff --git a/src/box3d.cpp b/src/box3d.cpp
index ea1e35982..23f934b64 100644
--- a/src/box3d.cpp
+++ b/src/box3d.cpp
@@ -1422,7 +1422,7 @@ box3d_convert_to_guides(SPItem *item) {
box3d_push_back_corner_pair(box, pts, 2, 6);
box3d_push_back_corner_pair(box, pts, 3, 7);
- sp_guide_pt_pairs_to_guides(inkscape_active_desktop(), pts);
+ sp_guide_pt_pairs_to_guides(item->document, pts);
}
/*
diff --git a/src/sp-guide.cpp b/src/sp-guide.cpp
index f71bc1762..45491e5e5 100644
--- a/src/sp-guide.cpp
+++ b/src/sp-guide.cpp
@@ -261,9 +261,8 @@ static void sp_guide_set(SPObject *object, unsigned int key, const gchar *value)
}
}
-SPGuide *SPGuide::createSPGuide(SPDesktop *desktop, Geom::Point const &pt1, Geom::Point const &pt2)
+SPGuide *SPGuide::createSPGuide(SPDocument *doc, Geom::Point const &pt1, Geom::Point const &pt2)
{
- SPDocument *doc = sp_desktop_document(desktop);
Inkscape::XML::Document *xml_doc = doc->getReprDoc();
Inkscape::XML::Node *repr = xml_doc->createElement("sodipodi:guide");
@@ -273,7 +272,10 @@ SPGuide *SPGuide::createSPGuide(SPDesktop *desktop, Geom::Point const &pt1, Geom
sp_repr_set_point(repr, "position", pt1);
sp_repr_set_point(repr, "orientation", n);
- desktop->namedview->appendChild(repr);
+ SPNamedView *namedview = sp_document_namedview(doc, NULL);
+ if (namedview) {
+ namedview->appendChild(repr);
+ }
Inkscape::GC::release(repr);
SPGuide *guide= SP_GUIDE(doc->getObjectByRepr(repr));
@@ -281,9 +283,9 @@ SPGuide *SPGuide::createSPGuide(SPDesktop *desktop, Geom::Point const &pt1, Geom
}
void
-sp_guide_pt_pairs_to_guides(SPDesktop *dt, std::list<std::pair<Geom::Point, Geom::Point> > &pts) {
+sp_guide_pt_pairs_to_guides(SPDocument *doc, std::list<std::pair<Geom::Point, Geom::Point> > &pts) {
for (std::list<std::pair<Geom::Point, Geom::Point> >::iterator i = pts.begin(); i != pts.end(); ++i) {
- SPGuide::createSPGuide(dt, (*i).first, (*i).second);
+ SPGuide::createSPGuide(doc, (*i).first, (*i).second);
}
}
@@ -302,7 +304,7 @@ sp_guide_create_guides_around_page(SPDesktop *dt) {
pts.push_back(std::make_pair<Geom::Point, Geom::Point>(C, D));
pts.push_back(std::make_pair<Geom::Point, Geom::Point>(D, A));
- sp_guide_pt_pairs_to_guides(dt, pts);
+ sp_guide_pt_pairs_to_guides(doc, pts);
DocumentUndo::done(doc, SP_VERB_NONE, _("Create Guides Around the Page"));
}
diff --git a/src/sp-guide.h b/src/sp-guide.h
index 4fbfbed3d..5d2a05791 100644
--- a/src/sp-guide.h
+++ b/src/sp-guide.h
@@ -43,7 +43,7 @@ public:
inline bool isHorizontal() const { return (normal_to_line[Geom::X] == 0.); };
inline bool isVertical() const { return (normal_to_line[Geom::Y] == 0.); };
inline double angle() const { return std::atan2( - normal_to_line[Geom::X], normal_to_line[Geom::Y] ); };
- static SPGuide *createSPGuide(SPDesktop *desktop, Geom::Point const &pt1, Geom::Point const &pt2);
+ static SPGuide *createSPGuide(SPDocument *doc, Geom::Point const &pt1, Geom::Point const &pt2);
void showSPGuide(SPCanvasGroup *group, GCallback handler);
void hideSPGuide(SPCanvas *canvas);
void sensitize(SPCanvas *canvas, gboolean sensitive);
@@ -58,7 +58,7 @@ public:
GType sp_guide_get_type();
-void sp_guide_pt_pairs_to_guides(SPDesktop *dt, std::list<std::pair<Geom::Point, Geom::Point> > &pts);
+void sp_guide_pt_pairs_to_guides(SPDocument *doc, std::list<std::pair<Geom::Point, Geom::Point> > &pts);
void sp_guide_create_guides_around_page(SPDesktop *dt);
void sp_guide_delete_all_guides(SPDesktop *dt);
diff --git a/src/sp-item.cpp b/src/sp-item.cpp
index 072d6d57b..946c94353 100644
--- a/src/sp-item.cpp
+++ b/src/sp-item.cpp
@@ -1574,9 +1574,6 @@ SPItem *sp_item_first_item_child(SPObject *obj)
}
void SPItem::convert_to_guides() {
- SPDesktop *dt = inkscape_active_desktop();
- sp_desktop_namedview(dt);
-
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
int prefs_bbox = prefs->getInt("/tools/bounding_box", 0);
SPItem::BBoxType bbox_type = (prefs_bbox ==0)?
@@ -1600,7 +1597,7 @@ void SPItem::convert_to_guides() {
pts.push_back(std::make_pair(C, D));
pts.push_back(std::make_pair(D, A));
- sp_guide_pt_pairs_to_guides(dt, pts);
+ sp_guide_pt_pairs_to_guides(document, pts);
}
/*
diff --git a/src/sp-line.cpp b/src/sp-line.cpp
index 0f467b68e..d3faf2299 100644
--- a/src/sp-line.cpp
+++ b/src/sp-line.cpp
@@ -184,7 +184,7 @@ void SPLine::convertToGuides(SPItem *item)
points[0] = Geom::Point(line->x1.computed, line->y1.computed)*i2dt;
points[1] = Geom::Point(line->x2.computed, line->y2.computed)*i2dt;
- SPGuide::createSPGuide(inkscape_active_desktop(), points[0], points[1]);
+ SPGuide::createSPGuide(item->document, points[0], points[1]);
}
Geom::Affine SPLine::setTransform(SPItem *item, Geom::Affine const &xform)
diff --git a/src/sp-path.cpp b/src/sp-path.cpp
index d9fb006f2..49cadc116 100644
--- a/src/sp-path.cpp
+++ b/src/sp-path.cpp
@@ -182,7 +182,7 @@ sp_path_convert_to_guides(SPItem *item)
}
}
- sp_guide_pt_pairs_to_guides(inkscape_active_desktop(), pts);
+ sp_guide_pt_pairs_to_guides(item->document, pts);
}
/**
diff --git a/src/sp-rect.cpp b/src/sp-rect.cpp
index ec83a47e9..467b37d17 100644
--- a/src/sp-rect.cpp
+++ b/src/sp-rect.cpp
@@ -624,7 +624,7 @@ sp_rect_convert_to_guides(SPItem *item) {
pts.push_back(std::make_pair(A3, A4));
pts.push_back(std::make_pair(A4, A1));
- sp_guide_pt_pairs_to_guides(inkscape_active_desktop(), pts);
+ sp_guide_pt_pairs_to_guides(item->document, pts);
}
/*