Code

Node tool: special case node duplication for endnodes - select new endnode
[inkscape.git] / src / jabber_whiteboard / message-utilities.cpp
index 095c6bab3a1171d4aa044ec2609e2aad6ba01ba2..448cc23e16aa97db1a5f36a861f002e27577eb4c 100644 (file)
 
 #include "util/share.h"
 #include "util/list.h"
+#include "util/ucompose.hpp"
 
 #include "xml/node.h"
 #include "xml/attribute-record.h"
 #include "xml/repr.h"
 
 #include "jabber_whiteboard/defines.h"
-#include "jabber_whiteboard/typedefs.h"
 #include "jabber_whiteboard/node-utilities.h"
 #include "jabber_whiteboard/message-utilities.h"
 #include "jabber_whiteboard/node-tracker.h"
@@ -38,6 +38,27 @@ namespace Whiteboard {
 // in the maps referenced by newidsbuf and newnodesbuf.  Passing NULL as the message buffer has the same effect.
 //
 // only_collect_nodes defaults to false because most invocations of this method also use the message string.
+
+Glib::ustring
+MessageUtilities::objectToString(Inkscape::XML::Node *element)
+{
+    if(element->type() == Inkscape::XML::TEXT_NODE)
+        return String::ucompose("<text>%1</text>",element->content());
+
+    Glib::ustring attributes;
+
+    for ( Inkscape::Util::List<Inkscape::XML::AttributeRecord const> 
+        iter = element->attributeList() ; iter ; ++iter )
+    {
+        attributes.append(g_quark_to_string(iter->key));
+        attributes.append("=\"");
+        attributes.append(iter->value);
+        attributes.append("\" ");
+    }
+
+    return String::ucompose("<%1 %2/>",element->name(),attributes);
+}
+/*
 void
 MessageUtilities::newObjectMessage(Glib::ustring &msgbuf, 
                        KeyNodeTable& newnodesbuf,
@@ -105,7 +126,7 @@ MessageUtilities::newObjectMessage(Glib::ustring &msgbuf,
                 //g_log(NULL, G_LOG_LEVEL_DEBUG, "Processing special node; not generating key");
                id = xmt->get(*node);
                if (id.empty()) {
-                       g_warning(_("Node %p (name %s) is a special node, but it could not be found in the node tracker (possible unexpected duplicate?)  Generating unique ID anyway."), node, node->name());
+                       g_warning("Node %p (name %s) is a special node, but it could not be found in the node tracker (possible unexpected duplicate?)  Generating unique ID anyway.", node, node->name());
                        id = xmt->generateKey();
                        newnodesbuf.put(id, node);
                }
@@ -272,7 +293,7 @@ MessageUtilities::objectDeleteMessage(Glib::ustring &msgbuf,
     parentid = parent.attribute("id");
     if (prev != NULL) {
             previd = prev->attribute("id");
-    }*/
+    }
 
     Glib::ustring parentid, previd, childid;
 
@@ -362,7 +383,7 @@ MessageUtilities::childOrderChangeMessage(Glib::ustring& msgbuf,
     msgbuf = msgbuf + "<" + MESSAGE_OLDVAL + ">";
     msgbuf += (*oldprevid);
     msgbuf = msgbuf + "</" + MESSAGE_OLDVAL + ">";
-    */
+    
 
     // <MESSAGE_NEWVAL>newprevid</MESSAGE_NEWVAL>
     msgbuf = msgbuf + "<" + MESSAGE_NEWVAL + ">";
@@ -452,7 +473,7 @@ MessageUtilities::makeTagWithContent(const Glib::ustring &tagname,
     buf += "</" + tagname + ">";
     return buf;
 }
-
+*/
 
 }