=== modified file 'src/extension/dbus/document-interface.cpp' --- src/extension/dbus/document-interface.cpp 2011-01-21 13:38:26 +0000 +++ src/extension/dbus/document-interface.cpp 2011-01-24 11:09:35 +0000 @@ -485,17 +485,28 @@ return retval; } -gboolean +gchar* document_interface_text (DocumentInterface *object, int x, int y, gchar *text, GError **error) { - //FIXME: Not selectable (aka broken). Needs to be rewritten completely. - - SPDesktop *desktop = object->desk; - SPCanvasText * canvas_text = (SPCanvasText *) sp_canvastext_new(sp_desktop_tempgroup(desktop), desktop, Geom::Point(0,0), ""); - sp_canvastext_set_text (canvas_text, text); - sp_canvastext_set_coords (canvas_text, x, y); - - return TRUE; + + Inkscape::XML::Node *text_node = dbus_create_node(object->desk, "svg:text"); + Inkscape::XML::Node *tspan_node = NULL; + + tspan_node = dbus_create_node(object->desk, "svg:tspan"); + sp_repr_set_svg_double(tspan_node, "x", x); + sp_repr_set_svg_double(tspan_node, "y", y); + tspan_node->setAttribute("sodipodi:role", "line"); + // Add text content node to tspan + SPDocument * doc = sp_desktop_document (object->desk); + Inkscape::XML::Document *xml_doc = doc->getReprDoc(); + + Inkscape::XML::Node *text_content = xml_doc->createTextNode(text); + tspan_node->appendChild(text_content); + text_node->appendChild(tspan_node); + Inkscape::GC::release(text_content); //not sure what to gc + Inkscape::GC::release(tspan_node); + Inkscape::GC::release(text_node); + return finish_create_shape (object, error, text_node, (gchar *)"create text"); } gchar * === modified file 'src/extension/dbus/document-interface.h' --- src/extension/dbus/document-interface.h 2011-01-21 13:38:26 +0000 +++ src/extension/dbus/document-interface.h 2011-01-24 11:09:35 +0000 @@ -107,7 +107,7 @@ document_interface_line (DocumentInterface *object, int x, int y, int x2, int y2, GError **error); -gboolean +gchar* document_interface_text (DocumentInterface *object, int x, int y, gchar *text, GError **error); === modified file 'src/extension/dbus/document-interface.xml' --- src/extension/dbus/document-interface.xml 2009-08-15 18:26:08 +0000 +++ src/extension/dbus/document-interface.xml 2011-01-24 11:59:06 +0000 @@ -310,6 +310,12 @@ The text you want. + + + + The name of the new text. + + This method creates some text in the current layer. === modified file 'src/extension/dbus/wrapper/inkscape-dbus-wrapper.c' --- src/extension/dbus/wrapper/inkscape-dbus-wrapper.c 2010-01-01 04:38:19 +0000 +++ src/extension/dbus/wrapper/inkscape-dbus-wrapper.c 2011-01-24 11:02:58 +0000 @@ -198,11 +198,13 @@ } //static -gboolean +char * inkscape_text (DocumentInterface *doc, const gint IN_x, const gint IN_y, const char * IN_text, GError **error) { + char * OUT_object_name; DBusGProxy *proxy = doc->proxy; - return org_inkscape_document_text (proxy, IN_x, IN_y, IN_text, error); + org_inkscape_document_text (proxy, IN_x, IN_y, IN_text, &OUT_object_name, error); + return OUT_object_name; } //static === modified file 'src/extension/dbus/wrapper/inkscape-dbus-wrapper.h' --- src/extension/dbus/wrapper/inkscape-dbus-wrapper.h 2009-08-13 20:53:03 +0000 +++ src/extension/dbus/wrapper/inkscape-dbus-wrapper.h 2011-01-24 10:27:31 +0000 @@ -72,7 +72,7 @@ inkscape_line (DocumentInterface *doc, const gint IN_x, const gint IN_y, const gint IN_x2, const gint IN_y2, GError **error); //static -gboolean +char * inkscape_text (DocumentInterface *doc, const gint IN_x, const gint IN_y, const char * IN_text, GError **error); //static