diff options
| author | Soren Berg <glimmer07@gmail.com> | 2009-07-20 22:55:35 +0000 |
|---|---|---|
| committer | glimmer07 <glimmer07@users.sourceforge.net> | 2009-07-20 22:55:35 +0000 |
| commit | 40d5732d5a327c51e04c6aaab97725d0d61b2327 (patch) | |
| tree | 06a5bbfc47417750cf97db05aa7ae6d67b8d6cc7 /src | |
| parent | Fixed selection_get() (diff) | |
| download | inkscape-40d5732d5a327c51e04c6aaab97725d0d61b2327.tar.gz inkscape-40d5732d5a327c51e04c6aaab97725d0d61b2327.zip | |
Fixed selection_get_center and selection_combine.
Added selection_divide.
(bzr r8254.1.16)
Diffstat (limited to 'src')
| -rw-r--r-- | src/extension/dbus/document-interface.cpp | 37 | ||||
| -rw-r--r-- | src/extension/dbus/document-interface.h | 6 | ||||
| -rw-r--r-- | src/extension/dbus/document-interface.xml | 17 |
3 files changed, 49 insertions, 11 deletions
diff --git a/src/extension/dbus/document-interface.cpp b/src/extension/dbus/document-interface.cpp index b9d8848cc..a939064e1 100644 --- a/src/extension/dbus/document-interface.cpp +++ b/src/extension/dbus/document-interface.cpp @@ -745,7 +745,6 @@ document_interface_selection_add_list (DocumentInterface *object, { int i; for (i=0;names[i] != NULL;i++) { - //printf("NAME: %s\n", names[i]); document_interface_selection_add(object, names[i], error); } return TRUE; @@ -767,7 +766,6 @@ document_interface_selection_set_list (DocumentInterface *object, sp_desktop_selection(object->desk)->clear(); int i; for (i=0;names[i] != NULL;i++) { - //printf("NAME: %s\n", names[i]); document_interface_selection_add(object, names[i], error); } return TRUE; @@ -882,7 +880,6 @@ document_interface_selection_move_to (DocumentInterface *object, gdouble x, gdou Geom::OptRect sel_bbox = sel->bounds(); if (sel_bbox) { - //Geom::Point m( (object->desk)->point() - sel_bbox->midpoint() ); Geom::Point m( x - selection_get_center_x(sel) , 0 - (y - selection_get_center_y(sel)) ); sp_selection_move_relative(sel, m, true); } @@ -915,11 +912,23 @@ document_interface_selection_move_to_layer (DocumentInterface *object, return TRUE; } -gboolean +GArray * document_interface_selection_get_center (DocumentInterface *object) { - //FIXME: implement: pass struct. - return FALSE; + Inkscape::Selection * sel = sp_desktop_selection(object->desk); + + if (sel) + { + gdouble x = selection_get_center_x(sel); + gdouble y = selection_get_center_y(sel); + GArray * intArr = g_array_new (TRUE, TRUE, sizeof(double)); + + g_array_append_val (intArr, x); + g_array_append_val (intArr, y); + return intArr; + } + + return NULL; } gboolean @@ -933,7 +942,6 @@ gchar * document_interface_selection_combine (DocumentInterface *object, gchar *cmd, GError **error) { - if (strcmp(cmd, "union") == 0) dbus_call_verb (object, SP_VERB_SELECTION_UNION, error); else if (strcmp(cmd, "intersection") == 0) @@ -947,8 +955,19 @@ document_interface_selection_combine (DocumentInterface *object, gchar *cmd, else return NULL; - //FIXME: this WILL cause problems with division - return g_strdup((sp_desktop_selection(object->desk)->singleRepr())->attribute("id")); + 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; +} + +gboolean +document_interface_selection_divide (DocumentInterface *object, char ***out, GError **error) +{ + dbus_call_verb (object, SP_VERB_SELECTION_CUT, error); + + return document_interface_selection_get (object, out, error); } gboolean diff --git a/src/extension/dbus/document-interface.h b/src/extension/dbus/document-interface.h index 53fcacaaa..afad56f59 100644 --- a/src/extension/dbus/document-interface.h +++ b/src/extension/dbus/document-interface.h @@ -298,7 +298,7 @@ gboolean document_interface_selection_move_to_layer (DocumentInterface *object, gchar *layerstr, GError **error); -gboolean +GArray * document_interface_selection_get_center (DocumentInterface *object); gboolean @@ -308,6 +308,10 @@ gchar * document_interface_selection_combine (DocumentInterface *object, gchar *cmd, GError **error); +gboolean +document_interface_selection_divide (DocumentInterface *object, + char ***out, GError **error); + gboolean document_interface_selection_change_level (DocumentInterface *object, gchar *cmd, diff --git a/src/extension/dbus/document-interface.xml b/src/extension/dbus/document-interface.xml index 5db3de763..171508dcd 100644 --- a/src/extension/dbus/document-interface.xml +++ b/src/extension/dbus/document-interface.xml @@ -1084,7 +1084,7 @@ </method> <method name="selection_get_center"> - <arg type="(ii)" name="centerpoint" direction="out" > + <arg type="ad" name="centerpoint" direction="out" > <annotation name="org.freedesktop.DBus.GLib.ReturnVal" value=""/> <doc:doc> <doc:summary>Center of the selection.</doc:summary> @@ -1132,6 +1132,21 @@ </doc:doc> </method> + <method name="selection_divide"> + <arg type="as" name="pieces" direction="out" > + <!-- <annotation name="org.freedesktop.DBus.GLib.ReturnVal" value=""/> --> + <doc:doc> + <doc:summary>List of the ids of resulting paths.</doc:summary> + </doc:doc> + </arg> + <doc:doc> + <doc:description> + <doc:para>Returns the result of cutting the bottom object by all other intersecting paths.</doc:para> + <doc:para>This may make many seperate layers.</doc:para> + </doc:description> + </doc:doc> + </method> + <method name="selection_change_level" > <arg type="s" name="command" direction="in" > <doc:doc> |
