diff options
| author | Soren Berg <glimmer07@gmail.com> | 2009-07-21 01:48:22 +0000 |
|---|---|---|
| committer | glimmer07 <glimmer07@users.sourceforge.net> | 2009-07-21 01:48:22 +0000 |
| commit | c30b66d5e5f875384b4fa13f93ceb6bea8054830 (patch) | |
| tree | 9895fd7aaebc20c5f21e688b018bae26209d24ab /src | |
| parent | Fixed selection_get_center and selection_combine. (diff) | |
| download | inkscape-c30b66d5e5f875384b4fa13f93ceb6bea8054830.tar.gz inkscape-c30b66d5e5f875384b4fa13f93ceb6bea8054830.zip | |
Worked on text, now works with limited capability.
Started work on node_get_coordinates.
(bzr r8254.1.17)
Diffstat (limited to 'src')
| -rw-r--r-- | src/extension/dbus/document-interface.cpp | 40 | ||||
| -rw-r--r-- | src/extension/dbus/document-interface.h | 8 | ||||
| -rw-r--r-- | src/extension/dbus/document-interface.xml | 16 |
3 files changed, 38 insertions, 26 deletions
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 @@ </method> <method name="text"> - <arg type="s" name="text" direction="in" > + <arg type="i" name="x" direction="in" > <doc:doc> - <doc:summary>The text you want.</doc:summary> + <doc:summary>The x coordinate to put the text at.</doc:summary> </doc:doc> </arg> - <arg type="s" name="object_name" direction="out" > - <annotation name="org.freedesktop.DBus.GLib.ReturnVal" value="error"/> + <arg type="i" name="y" direction="in" > <doc:doc> - <doc:summary>The name of the new text object.</doc:summary> + <doc:summary>The y coordinate to put the text at.</doc:summary> + </doc:doc> + </arg> + <arg type="s" name="text" direction="in" > + <doc:doc> + <doc:summary>The text you want.</doc:summary> </doc:doc> </arg> <doc:doc> @@ -688,7 +692,7 @@ <doc:summary>A object that contains a path ("d") attribute.</doc:summary> </doc:doc> </arg> - <arg type="a(ii)" name="points" direction="out" > + <arg type="ai" name="points" direction="out" > <annotation name="org.freedesktop.DBus.GLib.ReturnVal" value=""/> <doc:doc> <doc:summary>An array of points.</doc:summary> |
