summaryrefslogtreecommitdiffstats
path: root/src/ui
diff options
context:
space:
mode:
authorJon A. Cruz <jon@joncruz.org>2011-06-04 02:45:55 +0000
committerJon A. Cruz <jon@joncruz.org>2011-06-04 02:45:55 +0000
commit3638efba5bec8a6afc9211aa6bbe289767d20b38 (patch)
treecbf344e828109b1c37e2feee53cddd0c68a8cf83 /src/ui
parentgerman translation update (diff)
downloadinkscape-3638efba5bec8a6afc9211aa6bbe289767d20b38.tar.gz
inkscape-3638efba5bec8a6afc9211aa6bbe289767d20b38.zip
Removed outdated/unsafe SP_DOCUMENT_DEFS macro and reduced usage of SP_ROOT() gtk type function/macro.
(bzr r10254)
Diffstat (limited to 'src/ui')
-rw-r--r--src/ui/clipboard.cpp6
-rw-r--r--src/ui/dialog/align-and-distribute.cpp3
-rw-r--r--src/ui/dialog/document-properties.cpp12
-rw-r--r--src/ui/dialog/find.cpp1
-rw-r--r--src/ui/dialog/layers.cpp7
-rw-r--r--src/ui/dialog/svg-fonts-dialog.cpp4
-rw-r--r--src/ui/dialog/swatches.cpp4
-rw-r--r--src/ui/widget/entity-entry.cpp9
-rw-r--r--src/ui/widget/page-sizer.cpp2
9 files changed, 26 insertions, 22 deletions
diff --git a/src/ui/clipboard.cpp b/src/ui/clipboard.cpp
index 4f4f8a022..60379a966 100644
--- a/src/ui/clipboard.cpp
+++ b/src/ui/clipboard.cpp
@@ -894,7 +894,7 @@ void ClipboardManagerImpl::_pasteDefs(SPDesktop *desktop, SPDocument *clipdoc)
SPDocument *target_document = sp_desktop_document(desktop);
Inkscape::XML::Node *root = clipdoc->getReprRoot();
Inkscape::XML::Node *defs = sp_repr_lookup_name(root, "svg:defs", 1);
- Inkscape::XML::Node *target_defs = SP_DOCUMENT_DEFS(target_document)->getRepr();
+ Inkscape::XML::Node *target_defs = target_document->getDefs()->getRepr();
Inkscape::XML::Document *target_xmldoc = target_document->getReprDoc();
prevent_id_clashes(clipdoc, target_document);
@@ -1197,7 +1197,7 @@ void ClipboardManagerImpl::_onGet(Gtk::SelectionData &sel, guint /*info*/)
gdouble dpi = PX_PER_IN;
guint32 bgcolor = 0x00000000;
- Geom::Point origin (SP_ROOT(_clipboardSPDoc->root)->x.computed, SP_ROOT(_clipboardSPDoc->root)->y.computed);
+ Geom::Point origin (_clipboardSPDoc->getRoot()->x.computed, _clipboardSPDoc->getRoot()->y.computed);
Geom::Rect area = Geom::Rect(origin, origin + _clipboardSPDoc->getDimensions());
unsigned long int width = (unsigned long int) (area.width() * dpi / PX_PER_IN + 0.5);
@@ -1254,7 +1254,7 @@ void ClipboardManagerImpl::_createInternalClipboard()
if ( _clipboardSPDoc == NULL ) {
_clipboardSPDoc = SPDocument::createNewDoc(NULL, false, true);
//g_assert( _clipboardSPDoc != NULL );
- _defs = SP_DOCUMENT_DEFS(_clipboardSPDoc)->getRepr();
+ _defs = _clipboardSPDoc->getDefs()->getRepr();
_doc = _clipboardSPDoc->getReprDoc();
_root = _clipboardSPDoc->getReprRoot();
diff --git a/src/ui/dialog/align-and-distribute.cpp b/src/ui/dialog/align-and-distribute.cpp
index 81e2b64a9..a2169c0b3 100644
--- a/src/ui/dialog/align-and-distribute.cpp
+++ b/src/ui/dialog/align-and-distribute.cpp
@@ -43,6 +43,7 @@
#include "util/glib-list-iterators.h"
#include "verbs.h"
#include "widgets/icon.h"
+#include "sp-root.h"
#include "align-and-distribute.h"
@@ -171,7 +172,7 @@ private :
case AlignAndDistribute::DRAWING:
{
- Geom::OptRect b = static_cast<SPItem *>( sp_desktop_document(desktop)->getRoot() )->getBboxDesktop();
+ Geom::OptRect b = sp_desktop_document(desktop)->getRoot()->getBboxDesktop();
if (b) {
mp = Geom::Point(a.mx0 * b->min()[Geom::X] + a.mx1 * b->max()[Geom::X],
a.my0 * b->min()[Geom::Y] + a.my1 * b->max()[Geom::Y]);
diff --git a/src/ui/dialog/document-properties.cpp b/src/ui/dialog/document-properties.cpp
index 0c001da4b..b2ca2a3a8 100644
--- a/src/ui/dialog/document-properties.cpp
+++ b/src/ui/dialog/document-properties.cpp
@@ -145,7 +145,7 @@ DocumentProperties::init()
Inkscape::XML::Node *repr = sp_desktop_namedview(getDesktop())->getRepr();
repr->addListener (&_repr_events, this);
- Inkscape::XML::Node *root = sp_desktop_document(getDesktop())->root->getRepr();
+ Inkscape::XML::Node *root = sp_desktop_document(getDesktop())->getRoot()->getRepr();
root->addListener (&_repr_events, this);
show_all_children();
@@ -156,7 +156,7 @@ DocumentProperties::~DocumentProperties()
{
Inkscape::XML::Node *repr = sp_desktop_namedview(getDesktop())->getRepr();
repr->removeListenerByData (this);
- Inkscape::XML::Node *root = sp_desktop_document(getDesktop())->root->getRepr();
+ Inkscape::XML::Node *root = sp_desktop_document(getDesktop())->getRoot()->getRepr();
root->removeListenerByData (this);
}
@@ -421,7 +421,7 @@ DocumentProperties::linkSelectedProfile()
xml_doc->root()->addChild(defsRepr, NULL);
}
- g_assert(SP_ROOT(desktop->doc()->root)->defs);
+ g_assert(desktop->doc()->getDefs());
defsRepr->addChild(cprofRepr, NULL);
// TODO check if this next line was sometimes needed. It being there caused an assertion.
@@ -877,7 +877,7 @@ DocumentProperties::_handleDocumentReplaced(SPDesktop* desktop, SPDocument *docu
{
Inkscape::XML::Node *repr = sp_desktop_namedview(desktop)->getRepr();
repr->addListener(&_repr_events, this);
- Inkscape::XML::Node *root = document->root->getRepr();
+ Inkscape::XML::Node *root = document->getRoot()->getRepr();
root->addListener(&_repr_events, this);
update();
}
@@ -887,7 +887,7 @@ DocumentProperties::_handleActivateDesktop(Inkscape::Application *, SPDesktop *d
{
Inkscape::XML::Node *repr = sp_desktop_namedview(desktop)->getRepr();
repr->addListener(&_repr_events, this);
- Inkscape::XML::Node *root = sp_desktop_document(desktop)->root->getRepr();
+ Inkscape::XML::Node *root = sp_desktop_document(desktop)->getRoot()->getRepr();
root->addListener(&_repr_events, this);
update();
}
@@ -897,7 +897,7 @@ DocumentProperties::_handleDeactivateDesktop(Inkscape::Application *, SPDesktop
{
Inkscape::XML::Node *repr = sp_desktop_namedview(desktop)->getRepr();
repr->removeListenerByData(this);
- Inkscape::XML::Node *root = sp_desktop_document(desktop)->root->getRepr();
+ Inkscape::XML::Node *root = sp_desktop_document(desktop)->getRoot()->getRepr();
root->removeListenerByData(this);
}
diff --git a/src/ui/dialog/find.cpp b/src/ui/dialog/find.cpp
index bdae14c62..aa6b4081e 100644
--- a/src/ui/dialog/find.cpp
+++ b/src/ui/dialog/find.cpp
@@ -50,6 +50,7 @@
#include "sp-use.h"
#include "sp-image.h"
#include "sp-offset.h"
+#include "sp-root.h"
#include "xml/repr.h"
diff --git a/src/ui/dialog/layers.cpp b/src/ui/dialog/layers.cpp
index 0eca5bbca..30924ab86 100644
--- a/src/ui/dialog/layers.cpp
+++ b/src/ui/dialog/layers.cpp
@@ -35,6 +35,7 @@
#include "verbs.h"
#include "widgets/icon.h"
#include "xml/repr.h"
+#include "sp-root.h"
#include "layers.h"
@@ -293,7 +294,7 @@ bool LayersPanel::_checkForUpdated(const Gtk::TreePath &/*path*/, const Gtk::Tre
}
void LayersPanel::_selectLayer( SPObject *layer ) {
- if ( !layer || (_desktop && _desktop->doc() && (layer == _desktop->doc()->root)) ) {
+ if ( !layer || (_desktop && _desktop->doc() && (layer == _desktop->doc()->getRoot())) ) {
if ( _tree.get_selection()->count_selected_rows() != 0 ) {
_tree.get_selection()->unselect_all();
}
@@ -328,7 +329,7 @@ void LayersPanel::_layersChanged()
// g_message("_layersChanged()");
if (_desktop) {
SPDocument* document = _desktop->doc();
- SPObject* root = document->root;
+ SPRoot* root = document->getRoot();
if ( root ) {
_selectedConnection.block();
if ( _desktop->layer_manager && _desktop->layer_manager->includes( root ) ) {
@@ -402,7 +403,7 @@ void LayersPanel::_pushTreeSelectionToCurrent()
_desktop->layer_manager->setCurrentLayer( inTree );
}
} else {
- _desktop->layer_manager->setCurrentLayer( _desktop->doc()->root );
+ _desktop->layer_manager->setCurrentLayer( _desktop->doc()->getRoot() );
}
}
}
diff --git a/src/ui/dialog/svg-fonts-dialog.cpp b/src/ui/dialog/svg-fonts-dialog.cpp
index 4d53154d8..fbca0bf10 100644
--- a/src/ui/dialog/svg-fonts-dialog.cpp
+++ b/src/ui/dialog/svg-fonts-dialog.cpp
@@ -794,7 +794,7 @@ SPFont *new_font(SPDocument *document)
{
g_return_val_if_fail(document != NULL, NULL);
- SPDefs *defs = (SPDefs *) SP_DOCUMENT_DEFS(document);
+ SPDefs *defs = document->getDefs();
Inkscape::XML::Document *xml_doc = document->getReprDoc();
@@ -911,7 +911,7 @@ SvgFontsDialog::SvgFontsDialog()
_FontsList.signal_button_release_event().connect_notify(sigc::mem_fun(*this, &SvgFontsDialog::fonts_list_button_release));
create_fonts_popup_menu(_FontsList, sigc::mem_fun(*this, &SvgFontsDialog::remove_selected_font));
- _defs_observer.set(SP_DOCUMENT_DEFS(sp_desktop_document(this->getDesktop())));
+ _defs_observer.set(sp_desktop_document(this->getDesktop())->getDefs());
_defs_observer.signal_changed().connect(sigc::mem_fun(*this, &SvgFontsDialog::update_fonts));
_getContents()->show_all();
diff --git a/src/ui/dialog/swatches.cpp b/src/ui/dialog/swatches.cpp
index 935fe9806..0f4626126 100644
--- a/src/ui/dialog/swatches.cpp
+++ b/src/ui/dialog/swatches.cpp
@@ -858,8 +858,8 @@ void SwatchesPanel::_trackDocument( SwatchesPanel *panel, SPDocument *document )
docPerPanel[panel] = document;
if (!found) {
sigc::connection conn1 = document->connectResourcesChanged( "gradient", sigc::bind(sigc::ptr_fun(&SwatchesPanel::handleGradientsChange), document) );
- sigc::connection conn2 = SP_DOCUMENT_DEFS(document)->connectRelease( sigc::hide(sigc::bind(sigc::ptr_fun(&SwatchesPanel::handleDefsModified), document)) );
- sigc::connection conn3 = SP_DOCUMENT_DEFS(document)->connectModified( sigc::hide(sigc::hide(sigc::bind(sigc::ptr_fun(&SwatchesPanel::handleDefsModified), document))) );
+ sigc::connection conn2 = document->getDefs()->connectRelease( sigc::hide(sigc::bind(sigc::ptr_fun(&SwatchesPanel::handleDefsModified), document)) );
+ sigc::connection conn3 = document->getDefs()->connectModified( sigc::hide(sigc::hide(sigc::bind(sigc::ptr_fun(&SwatchesPanel::handleDefsModified), document))) );
DocTrack *dt = new DocTrack(document, conn1, conn2, conn3);
docTrackings.push_back(dt);
diff --git a/src/ui/widget/entity-entry.cpp b/src/ui/widget/entity-entry.cpp
index e191a9360..e62eb009c 100644
--- a/src/ui/widget/entity-entry.cpp
+++ b/src/ui/widget/entity-entry.cpp
@@ -25,6 +25,7 @@
#include "sp-object.h"
#include "rdf.h"
#include "ui/widget/registry.h"
+#include "sp-root.h"
#include "entity-entry.h"
@@ -87,8 +88,8 @@ void EntityLineEntry::update(SPDocument *doc)
{
const char *text = rdf_get_work_entity (doc, _entity);
// If RDF title is not set, get the document's <title> and set the RDF:
- if ( !text && !strcmp(_entity->name, "title") && doc->root ) {
- text = doc->root->title();
+ if ( !text && !strcmp(_entity->name, "title") && doc->getRoot() ) {
+ text = doc->getRoot()->title();
rdf_set_work_entity(doc, _entity, text);
}
static_cast<Gtk::Entry*>(_packable)->set_text (text ? text : "");
@@ -133,8 +134,8 @@ void EntityMultiLineEntry::update(SPDocument *doc)
{
const char *text = rdf_get_work_entity (doc, _entity);
// If RDF title is not set, get the document's <title> and set the RDF:
- if ( !text && !strcmp(_entity->name, "title") && doc->root ) {
- text = doc->root->title();
+ if ( !text && !strcmp(_entity->name, "title") && doc->getRoot() ) {
+ text = doc->getRoot()->title();
rdf_set_work_entity(doc, _entity, text);
}
Gtk::ScrolledWindow *s = static_cast<Gtk::ScrolledWindow*>(_packable);
diff --git a/src/ui/widget/page-sizer.cpp b/src/ui/widget/page-sizer.cpp
index f306b9eea..672e1415b 100644
--- a/src/ui/widget/page-sizer.cpp
+++ b/src/ui/widget/page-sizer.cpp
@@ -422,7 +422,7 @@ PageSizer::setDim (double w, double h, bool changeList)
// The origin for the user is in the lower left corner; this point should remain stationary when
// changing the page size. The SVG's origin however is in the upper left corner, so we must compensate for this
Geom::Translate const vert_offset(Geom::Point(0, (old_height - h)));
- SP_GROUP(SP_ROOT(doc->root))->translateChildItems(vert_offset);
+ doc->getRoot()->translateChildItems(vert_offset);
DocumentUndo::done(doc, SP_VERB_NONE, _("Set page size"));
}