summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 0822237)
raw | patch | inline | side by side (parent: 0822237)
author | glimmer07 <glimmer07@users.sourceforge.net> | |
Tue, 21 Jul 2009 01:48:22 +0000 (01:48 +0000) | ||
committer | glimmer07 <glimmer07@users.sourceforge.net> | |
Tue, 21 Jul 2009 01:48:22 +0000 (01:48 +0000) |
Started work on node_get_coordinates.
src/extension/dbus/document-interface.cpp | patch | blob | history | |
src/extension/dbus/document-interface.h | patch | blob | history | |
src/extension/dbus/document-interface.xml | patch | blob | history |
index a939064e11eabaf2936fbf9d1e7a7dd71722908e..a28bb92fa090eaee74de2005be3fab56acfdfcec 100644 (file)
#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
****************************************************************************/
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*
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;
}
}
/****************************************************************************
- SELECTION FUNCTIONS FIXME: use call_verb where appropriate.
+ SELECTION FUNCTIONS FIXME: use call_verb where appropriate (once update system is tested.)
****************************************************************************/
gboolean
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;
}
index afad56f590f1f838b2ce649e6a861754210b791a..9b56da4177a6efd570e1f3483ade03b5cb75f418 100644 (file)
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,
gchar *layerstr, GError **error);
-DBUSPoint **
+GArray *
document_interface_get_node_coordinates (DocumentInterface *object, gchar *shape);
/****************************************************************************
index 171508dcdfa29de2db44297801c6f74dff10d5c3..7126887af76b3ec05030bc10d265fd0083a7717d 100644 (file)
</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>
<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>