summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: ea4e6ab)
raw | patch | inline | side by side (parent: ea4e6ab)
author | glimmer07 <glimmer07@users.sourceforge.net> | |
Mon, 20 Jul 2009 22:55:35 +0000 (22:55 +0000) | ||
committer | glimmer07 <glimmer07@users.sourceforge.net> | |
Mon, 20 Jul 2009 22:55:35 +0000 (22:55 +0000) |
Added selection_divide.
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 b9d8848cc9a212fdb3bc030267bdd8d897351b48..a939064e11eabaf2936fbf9d1e7a7dd71722908e 100644 (file)
{
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;
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);
}
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
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)
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
index 53fcacaaa30dbfeb08586c17e1ecbca829e4308f..afad56f590f1f838b2ce649e6a861754210b791a 100644 (file)
document_interface_selection_move_to_layer (DocumentInterface *object,
gchar *layerstr, GError **error);
-gboolean
+GArray *
document_interface_selection_get_center (DocumentInterface *object);
gboolean
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,
index 5db3de763aa034cf501adb1a210ab8cd5f4d27f2..171508dcdfa29de2db44297801c6f74dff10d5c3 100644 (file)
</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>
</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>