summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMenTaLguY <mental@rydia.net>2008-07-01 19:13:12 +0000
committermental <mental@users.sourceforge.net>2008-07-01 19:13:12 +0000
commitd9910a065c5fde12a75d1be34ea16df3e28adda0 (patch)
treea4e22d6ec336112373afb0885b9e743ee9df6047 /src
parentCxxTest unit tests can now be built on Windows, also adds CxxTest versions of... (diff)
downloadinkscape-d9910a065c5fde12a75d1be34ea16df3e28adda0.tar.gz
inkscape-d9910a065c5fde12a75d1be34ea16df3e28adda0.zip
remove last traces of "floating nodes"
(bzr r6107)
Diffstat (limited to 'src')
-rw-r--r--src/jabber_whiteboard/inkboard-document.cpp1
-rw-r--r--src/xml/node.h1
-rw-r--r--src/xml/simple-document.cpp4
-rw-r--r--src/xml/simple-document.h12
-rw-r--r--src/xml/simple-node.cpp39
-rw-r--r--src/xml/simple-node.h1
6 files changed, 8 insertions, 50 deletions
diff --git a/src/jabber_whiteboard/inkboard-document.cpp b/src/jabber_whiteboard/inkboard-document.cpp
index d4274f139..3e36d5c84 100644
--- a/src/jabber_whiteboard/inkboard-document.cpp
+++ b/src/jabber_whiteboard/inkboard-document.cpp
@@ -56,7 +56,6 @@ InkboardDocument::_initBindings()
this->sm = &SessionManager::instance();
this->state = State::INITIAL;
this->tracker = new KeyNodeTable();
- _bindDocument(*this);
}
void
diff --git a/src/xml/node.h b/src/xml/node.h
index ab7e2ba2f..1b3f18a91 100644
--- a/src/xml/node.h
+++ b/src/xml/node.h
@@ -108,7 +108,6 @@ public: // ideally these should be protected too somehow...
virtual NodeObserver &_subtreeObservers()=0;
virtual void _setParent(Node *parent)=0;
virtual void _setNext(Node *next)=0;
- virtual void _bindDocument(Document &document)=0;
virtual unsigned _childPosition(Node const &child) const=0;
virtual unsigned _cachedPosition() const=0;
diff --git a/src/xml/simple-document.cpp b/src/xml/simple-document.cpp
index 0a2cb15fb..d854f92fb 100644
--- a/src/xml/simple-document.cpp
+++ b/src/xml/simple-document.cpp
@@ -25,10 +25,6 @@ namespace Inkscape {
namespace XML {
-void SimpleDocument::_initBindings() {
- _bindDocument(*this);
-}
-
void SimpleDocument::beginTransaction() {
g_assert(!_in_transaction);
_in_transaction = true;
diff --git a/src/xml/simple-document.h b/src/xml/simple-document.h
index f2648e188..504be8248 100644
--- a/src/xml/simple-document.h
+++ b/src/xml/simple-document.h
@@ -31,10 +31,7 @@ class SimpleDocument : public SimpleNode,
public:
explicit SimpleDocument()
: SimpleNode(g_quark_from_static_string("xml"), this),
- _in_transaction(false)
- {
- _initBindings();
- }
+ _in_transaction(false) {}
NodeType type() const { return Inkscape::XML::DOCUMENT_NODE; }
@@ -70,10 +67,7 @@ public:
protected:
SimpleDocument(SimpleDocument const &doc)
: Node(), SimpleNode(doc), Document(), NodeObserver(),
- _in_transaction(false)
- {
- _initBindings();
- }
+ _in_transaction(false) {}
SimpleNode *_duplicate(Document* /*doc*/) const
{
@@ -81,8 +75,6 @@ protected:
}
private:
- void _initBindings();
-
bool _in_transaction;
LogBuilder _log_builder;
};
diff --git a/src/xml/simple-node.cpp b/src/xml/simple-node.cpp
index d4a412ae6..6c2ce7635 100644
--- a/src/xml/simple-node.cpp
+++ b/src/xml/simple-node.cpp
@@ -301,10 +301,7 @@ void SimpleNode::setContent(gchar const *content) {
_content = new_content;
if ( _content != old_content ) {
- if (_document) {
- _document->logger()->notifyContentChanged(*this, old_content, _content);
- }
-
+ _document->logger()->notifyContentChanged(*this, old_content, _content);
_observers.notifyContentChanged(*this, old_content, _content);
}
}
@@ -355,16 +352,14 @@ SimpleNode::setAttribute(gchar const *name, gchar const *value, bool const /*is_
}
if ( new_value != old_value && (!old_value || !new_value || strcmp(old_value, new_value))) {
- if (_document) {
- _document->logger()->notifyAttributeChanged(*this, key, old_value, new_value);
- }
-
+ _document->logger()->notifyAttributeChanged(*this, key, old_value, new_value);
_observers.notifyAttributeChanged(*this, key, old_value, new_value);
}
}
void SimpleNode::addChild(Node *child, Node *ref) {
g_assert(child);
+ g_assert(child->document() == _document);
g_assert(!ref || ref->parent() == this);
g_assert(!child->parent());
@@ -397,26 +392,10 @@ void SimpleNode::addChild(Node *child, Node *ref) {
child->_setNext(next);
_child_count++;
- if (_document) {
- child->_bindDocument(*_document);
- _document->logger()->notifyChildAdded(*this, *child, ref);
- }
-
+ _document->logger()->notifyChildAdded(*this, *child, ref);
_observers.notifyChildAdded(*this, *child, ref);
}
-void SimpleNode::_bindDocument(Document &document) {
- g_assert(!_document || _document == &document);
-
- if (!_document) {
- _document = &document;
-
- for ( Node *child = _first_child ; child != NULL ; child = child->next() ) {
- child->_bindDocument(document);
- }
- }
-}
-
void SimpleNode::removeChild(Node *child) {
g_assert(child);
g_assert(child->parent() == this);
@@ -442,10 +421,7 @@ void SimpleNode::removeChild(Node *child) {
child->_setParent(NULL);
_child_count--;
- if (_document) {
- _document->logger()->notifyChildRemoved(*this, *child, ref);
- }
-
+ _document->logger()->notifyChildRemoved(*this, *child, ref);
_observers.notifyChildRemoved(*this, *child, ref);
}
@@ -489,10 +465,7 @@ void SimpleNode::changeOrder(Node *child, Node *ref) {
_cached_positions_valid = false;
- if (_document) {
- _document->logger()->notifyChildOrderChanged(*this, *child, prev, ref);
- }
-
+ _document->logger()->notifyChildOrderChanged(*this, *child, prev, ref);
_observers.notifyChildOrderChanged(*this, *child, prev, ref);
}
diff --git a/src/xml/simple-node.h b/src/xml/simple-node.h
index 7c5556f27..0dece19b9 100644
--- a/src/xml/simple-node.h
+++ b/src/xml/simple-node.h
@@ -122,7 +122,6 @@ public: // ideally these should be protected somehow...
NodeObserver &_subtreeObservers() { return _subtree_observers; }
void _setParent(Node *parent);
void _setNext(Node *next) { _next = next; }
- void _bindDocument(Document &document);
unsigned _childPosition(Node const &child) const;
unsigned _cachedPosition() const { return _cached_position; }