From: glimmer07 Date: Tue, 21 Jul 2009 01:48:22 +0000 (+0000) Subject: Worked on text, now works with limited capability. X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=e33975c2dfafbf45d20b1c66390feac315909c57;p=inkscape.git Worked on text, now works with limited capability. Started work on node_get_coordinates. --- diff --git a/src/extension/dbus/document-interface.cpp b/src/extension/dbus/document-interface.cpp index a939064e1..a28bb92fa 100644 --- a/src/extension/dbus/document-interface.cpp +++ b/src/extension/dbus/document-interface.cpp @@ -32,6 +32,11 @@ #include "print.h" //IO +#include "live_effects/parameter/text.h" //text +#include "display/canvas-text.h" //text + +#include "2geom/svg-path-parser.h" //get_node_coordinates + /**************************************************************************** HELPER / SHORTCUT FUNCTIONS ****************************************************************************/ @@ -335,11 +340,17 @@ document_interface_spiral (DocumentInterface *object, int cx, int cy, return retval; } -gchar* -document_interface_text (DocumentInterface *object, gchar *text, GError **error) +gboolean +document_interface_text (DocumentInterface *object, int x, int y, gchar *text, GError **error) { - //FIXME: implement. - return NULL; + //FIXME: Not selectable. + + 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; } gchar* @@ -564,18 +575,19 @@ document_interface_move_to_layer (DocumentInterface *object, gchar *shape, return TRUE; } -DBUSPoint ** +GArray * document_interface_get_node_coordinates (DocumentInterface *object, gchar *shape) { //FIXME: Needs lot's of work. -/* - Inkscape::XML::Node *node = document_retrive_node (sp_desktop_document (object->desk), pathname); - if (node == NULL || node->attribute("d") == NULL) { - g_set_error(error, DBUS_GERROR, DBUS_GERROR_REMOTE_EXCEPTION, "Object is not a path or does not exist."); + + Inkscape::XML::Node *shapenode = document_retrive_node (sp_desktop_document (object->desk), shape); + if (shapenode == NULL || shapenode->attribute("d") == NULL) { return FALSE; } - //char * path = strdup(node->attribute("d")); -*/ + const char * path = strdup(shapenode->attribute("d")); + printf("PATH: %s\n", path); + + Geom::parse_svg_path (path); return NULL; } @@ -705,7 +717,7 @@ document_interface_update (DocumentInterface *object, GError **error) } /**************************************************************************** - SELECTION FUNCTIONS FIXME: use call_verb where appropriate. + SELECTION FUNCTIONS FIXME: use call_verb where appropriate (once update system is tested.) ****************************************************************************/ gboolean @@ -950,15 +962,11 @@ document_interface_selection_combine (DocumentInterface *object, gchar *cmd, dbus_call_verb (object, SP_VERB_SELECTION_DIFF, error); else if (strcmp(cmd, "exclusion") == 0) dbus_call_verb (object, SP_VERB_SELECTION_SYMDIFF, error); - else if (strcmp(cmd, "division") == 0) - dbus_call_verb (object, SP_VERB_SELECTION_CUT, error); else return NULL; if (sp_desktop_selection(object->desk)->singleRepr() != NULL) return g_strdup((sp_desktop_selection(object->desk)->singleRepr())->attribute("id")); - - //Division will have a list of things selected, should have it's own function. return NULL; } diff --git a/src/extension/dbus/document-interface.h b/src/extension/dbus/document-interface.h index afad56f59..9b56da417 100644 --- a/src/extension/dbus/document-interface.h +++ b/src/extension/dbus/document-interface.h @@ -76,9 +76,9 @@ gchar* document_interface_line (DocumentInterface *object, int x, int y, int x2, int y2, GError **error); -gchar* -document_interface_text (DocumentInterface *object, gchar *text, - GError **error); +gboolean +document_interface_text (DocumentInterface *object, int x, int y, + gchar *text, GError **error); gchar* document_interface_node (DocumentInterface *object, gchar *svgtype, @@ -169,7 +169,7 @@ document_interface_move_to_layer (DocumentInterface *object, gchar *shape, gchar *layerstr, GError **error); -DBUSPoint ** +GArray * document_interface_get_node_coordinates (DocumentInterface *object, gchar *shape); /**************************************************************************** diff --git a/src/extension/dbus/document-interface.xml b/src/extension/dbus/document-interface.xml index 171508dcd..7126887af 100644 --- a/src/extension/dbus/document-interface.xml +++ b/src/extension/dbus/document-interface.xml @@ -276,15 +276,19 @@ - + - The text you want. + The x coordinate to put the text at. - - + - The name of the new text object. + The y coordinate to put the text at. + + + + + The text you want. @@ -688,7 +692,7 @@ A object that contains a path ("d") attribute. - + An array of points.