diff options
| author | Jabier Arraiza Cenoz <jabier.arraiza@marker.es> | 2016-11-01 15:18:55 +0000 |
|---|---|---|
| committer | jabiertxof <info@marker.es> | 2016-11-01 15:18:55 +0000 |
| commit | efd3002943b5346bbaf961f3f02dc81c0ca0716d (patch) | |
| tree | f92291c0ef59518938aa5db1abcc39e57ffdfbd0 /src/file.cpp | |
| parent | Add fadding from temporary rotate draw to real ones (diff) | |
| parent | [Bug #1574561] Italian translation update. (diff) | |
| download | inkscape-efd3002943b5346bbaf961f3f02dc81c0ca0716d.tar.gz inkscape-efd3002943b5346bbaf961f3f02dc81c0ca0716d.zip | |
Add some Vlava improvements from mailing list
(bzr r15142.1.28)
Diffstat (limited to 'src/file.cpp')
| -rw-r--r-- | src/file.cpp | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/file.cpp b/src/file.cpp index b29bee6b4..49d7fece5 100644 --- a/src/file.cpp +++ b/src/file.cpp @@ -1195,12 +1195,23 @@ file_import(SPDocument *in_doc, const Glib::ustring &uri, // Count the number of top-level items in the imported document. guint items_count = 0; + SPObject *o = NULL; for (auto& child: doc->getRoot()->children) { if (SP_IS_ITEM(&child)) { items_count++; + o = &child; } } + //ungroup if necessary + bool did_ungroup = false; + while(items_count==1 && o && SP_IS_GROUP(o) && o->children.size()==1){ + std::vector<SPItem *>v; + sp_item_group_ungroup(SP_GROUP(o),v,false); + o = v.empty() ? NULL : v[0]; + did_ungroup=true; + } + // Create a new group if necessary. Inkscape::XML::Node *newgroup = NULL; if ((style && style->attributeList()) || items_count > 1) { @@ -1227,7 +1238,7 @@ file_import(SPDocument *in_doc, const Glib::ustring &uri, SPObject *new_obj = NULL; for (auto& child: doc->getRoot()->children) { if (SP_IS_ITEM(&child)) { - Inkscape::XML::Node *newitem = child.getRepr()->duplicate(xml_in_doc); + Inkscape::XML::Node *newitem = did_ungroup ? o->getRepr()->duplicate(xml_in_doc) : child.getRepr()->duplicate(xml_in_doc); // convert layers to groups, and make sure they are unlocked // FIXME: add "preserve layers" mode where each layer from |
