Code

fix inkboard node position bugs
authormental <mental@users.sourceforge.net>
Tue, 1 Jul 2008 23:08:26 +0000 (23:08 +0000)
committermental <mental@users.sourceforge.net>
Tue, 1 Jul 2008 23:08:26 +0000 (23:08 +0000)
src/jabber_whiteboard/inkboard-document.cpp
src/jabber_whiteboard/inkboard-node.cpp

index 3e36d5c8496bffdc3cf516e178edc2b603da3413..4b27d530a8f9db1402e942499382a8715c68cf39 100644 (file)
@@ -410,13 +410,10 @@ void InkboardDocument::notifyChildOrderChanged(XML::Node &parent,
 {
     if (_in_transaction && state == State::IN_WHITEBOARD) 
     {
-        XML::Node *element = (XML::Node *)&child;
-        XML::Node *parentElement = (XML::Node *)&parent;
-
-        unsigned int index = parentElement->_childPosition(*element);
+        unsigned int index = child.position();
 
         Message::Message message = String::ucompose(Vars::MOVE_MESSAGE,
-                tracker->get(element),index);
+                tracker->get(&child),index);
 
         send(getRecipient(),Message::MOVE,message);
     }
index e6eee7304eab1739c682fecbca4286912eb5ac7f..f84053b655d5a9c83e6738da3d8711096d4c5f96 100644 (file)
@@ -43,7 +43,6 @@ InkboardDocument::composeNewMessage(Inkscape::XML::Node *node)
 {
     Glib::ustring parentKey;
     Glib::ustring key = this->tracker->get(node);
-    Inkscape::XML::Node *parent = node->parent();
 
     Glib::ustring tempParentKey = this->tracker->get(node->parent());
     if(tempParentKey.size() < 1)
@@ -51,7 +50,7 @@ InkboardDocument::composeNewMessage(Inkscape::XML::Node *node)
     else
         parentKey = tempParentKey;
 
-    unsigned int index = parent->_childPosition(*node);
+    unsigned int index = node->position();
 
     Message::Message nodeMessage = MessageUtilities::objectToString(node);
     Message::Message message = String::ucompose(Vars::NEW_MESSAGE,parentKey,key,index,0,nodeMessage);