summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 3d42594)
raw | patch | inline | side by side (parent: 3d42594)
author | mental <mental@users.sourceforge.net> | |
Tue, 1 Jul 2008 19:13:12 +0000 (19:13 +0000) | ||
committer | mental <mental@users.sourceforge.net> | |
Tue, 1 Jul 2008 19:13:12 +0000 (19:13 +0000) |
diff --git a/src/jabber_whiteboard/inkboard-document.cpp b/src/jabber_whiteboard/inkboard-document.cpp
index d4274f139e5684a5be553d013268df56a822aedf..3e36d5c8496bffdc3cf516e178edc2b603da3413 100644 (file)
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 ab7e2ba2f97ed34e40eb8d005ac1ae80a0da5235..1b3f18a91746b983f46255281abd91ddb0e9a062 100644 (file)
--- a/src/xml/node.h
+++ b/src/xml/node.h
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;
index 0a2cb15fb67b79716e8bd8944cc13ea7fec56931..d854f92fb384365ab445d4b8ac0b9e8c0c3870cc 100644 (file)
namespace XML {
-void SimpleDocument::_initBindings() {
- _bindDocument(*this);
-}
-
void SimpleDocument::beginTransaction() {
g_assert(!_in_transaction);
_in_transaction = true;
index f2648e18805a4255171cb1663b49b8a7515d5979..504be824829f18d3e427d9a7eda52696ad6abcb9 100644 (file)
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; }
protected:
SimpleDocument(SimpleDocument const &doc)
: Node(), SimpleNode(doc), Document(), NodeObserver(),
- _in_transaction(false)
- {
- _initBindings();
- }
+ _in_transaction(false) {}
SimpleNode *_duplicate(Document* /*doc*/) const
{
}
private:
- void _initBindings();
-
bool _in_transaction;
LogBuilder _log_builder;
};
index d4a412ae63e1fb3e803283b37fba6085e1439fa0..6c2ce7635f50b91310c27bc1474375627508f52c 100644 (file)
--- a/src/xml/simple-node.cpp
+++ b/src/xml/simple-node.cpp
_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());
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);
child->_setParent(NULL);
_child_count--;
- if (_document) {
- _document->logger()->notifyChildRemoved(*this, *child, ref);
- }
-
+ _document->logger()->notifyChildRemoved(*this, *child, ref);
_observers.notifyChildRemoved(*this, *child, 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 7c5556f27466e6a4c2de73fc41f8db569bd1d1f2..0dece19b905d3866421eece35cc2f80d5b2bd112 100644 (file)
--- a/src/xml/simple-node.h
+++ b/src/xml/simple-node.h
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; }