summaryrefslogtreecommitdiffstats
path: root/src/path-chemistry.cpp
diff options
context:
space:
mode:
authorbulia byak <buliabyak@gmail.com>2008-12-29 05:31:53 +0000
committerbuliabyak <buliabyak@users.sourceforge.net>2008-12-29 05:31:53 +0000
commit0a7555e11700fd911c57cec7b88ab0c40d4daf57 (patch)
treeda0e56a0985aaa3a398c6e7d7c8e815aeadc4da9 /src/path-chemistry.cpp
parentadd utility for recursively replacing groups with their members in a list of ... (diff)
downloadinkscape-0a7555e11700fd911c57cec7b88ab0c40d4daf57.tar.gz
inkscape-0a7555e11700fd911c57cec7b88ab0c40d4daf57.zip
fix crash, allow combine to work transparently on groups
(bzr r7036)
Diffstat (limited to 'src/path-chemistry.cpp')
-rw-r--r--src/path-chemistry.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/path-chemistry.cpp b/src/path-chemistry.cpp
index 0227e9caf..6ef4b2742 100644
--- a/src/path-chemistry.cpp
+++ b/src/path-chemistry.cpp
@@ -36,6 +36,7 @@
#include "desktop-handles.h"
#include "box3d.h"
#include <2geom/pathvector.h>
+#include "selection-chemistry.h"
#include "path-chemistry.h"
void
@@ -44,8 +45,8 @@ sp_selected_path_combine(SPDesktop *desktop)
Inkscape::Selection *selection = sp_desktop_selection(desktop);
SPDocument *doc = sp_desktop_document(desktop);
- if (g_slist_length((GSList *) selection->itemList()) < 2) {
- sp_desktop_message_stack(desktop)->flash(Inkscape::WARNING_MESSAGE, _("Select <b>at least two objects</b> to combine."));
+ if (g_slist_length((GSList *) selection->itemList()) < 1) {
+ sp_desktop_message_stack(desktop)->flash(Inkscape::WARNING_MESSAGE, _("Select <b>object(s)</b> to combine."));
return;
}
@@ -54,10 +55,13 @@ sp_selected_path_combine(SPDesktop *desktop)
desktop->setWaitingCursor();
GSList *items = g_slist_copy((GSList *) selection->itemList());
+
+ items = sp_degroup_list (items); // descend into any groups in selection
+
GSList *to_paths = NULL;
for (GSList *i = items; i != NULL; i = i->next) {
SPItem *item = (SPItem *) i->data;
- if (!SP_IS_PATH(item))
+ if (!SP_IS_PATH(item) && !SP_IS_GROUP(item))
to_paths = g_slist_prepend(to_paths, item);
}
GSList *converted = NULL;
@@ -66,6 +70,8 @@ sp_selected_path_combine(SPDesktop *desktop)
for (GSList *i = converted; i != NULL; i = i->next)
items = g_slist_prepend(items, doc->getObjectByRepr((Inkscape::XML::Node*)(i->data)));
+ items = sp_degroup_list (items); // converting to path may have added more groups, descend again
+
items = g_slist_sort(items, (GCompareFunc) sp_item_repr_compare_position);
items = g_slist_reverse(items);