diff options
| author | Jabier Arraiza Cenoz <jabier.arraiza@marker.es> | 2013-11-23 21:17:06 +0000 |
|---|---|---|
| committer | Jabiertxof <jtx@jtx.marker.es> | 2013-11-23 21:17:06 +0000 |
| commit | 54b37c8fa5f39477f8d6fb50e90c7152806514d1 (patch) | |
| tree | bada98f3274c59825cbacf077fef07275108f8d4 /src | |
| parent | Update to trunk (diff) | |
| parent | reorder header file includes. Because glibmm depends on a deprecated/threads.... (diff) | |
| download | inkscape-54b37c8fa5f39477f8d6fb50e90c7152806514d1.tar.gz inkscape-54b37c8fa5f39477f8d6fb50e90c7152806514d1.zip | |
Update to trunk
(bzr r11950.1.203)
Diffstat (limited to 'src')
| -rw-r--r-- | src/graphlayout.cpp | 4 | ||||
| -rw-r--r-- | src/main.cpp | 5 | ||||
| -rw-r--r-- | src/selection-chemistry.cpp | 33 | ||||
| -rw-r--r-- | src/ui/dialog/ocaldialogs.cpp | 3 |
4 files changed, 27 insertions, 18 deletions
diff --git a/src/graphlayout.cpp b/src/graphlayout.cpp index b0e00211a..7e10ccca1 100644 --- a/src/graphlayout.cpp +++ b/src/graphlayout.cpp @@ -106,7 +106,7 @@ void graphlayout(GSList const *const items) { return; } - using Inkscape::Util::GSListConstIterator; + using Inkscape::Util::GSListIterator; list<SPItem *> selected; filterConnectors(items,selected); if (selected.empty()) return; @@ -167,7 +167,7 @@ void graphlayout(GSList const *const items) { GSList *nlist=iu->avoidRef->getAttachedConnectors(Avoid::runningFrom); list<SPItem *> connectors; - connectors.insert<GSListConstIterator<SPItem *> >(connectors.end(),nlist,NULL); + connectors.insert<GSListIterator<SPItem *> >(connectors.end(),nlist,NULL); for (list<SPItem *>::iterator j(connectors.begin()); j != connectors.end(); ++j) { diff --git a/src/main.cpp b/src/main.cpp index c6427dc6f..9f5a95ffe 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -26,12 +26,13 @@ #ifdef HAVE_CONFIG_H # include "config.h" #endif -#include "path-prefix.h" // This has to be included prior to anything that includes setjmp.h, it croaks otherwise #include <png.h> -#include "ui/widget/panel.h" +#include "ui/widget/panel.h" // This has to be the first to include <glib.h> because of Glibmm's dependence on a deprecated feature... + +#include "path-prefix.h" #ifdef HAVE_IEEEFP_H #include <ieeefp.h> diff --git a/src/selection-chemistry.cpp b/src/selection-chemistry.cpp index 26e575439..aa8c1d222 100644 --- a/src/selection-chemistry.cpp +++ b/src/selection-chemistry.cpp @@ -372,10 +372,10 @@ static GSList *sp_selection_paste_impl(SPDocument *doc, SPObject *parent, GSList static void sp_selection_delete_impl(GSList const *items, bool propagate = true, bool propagate_descendants = true) { for (GSList const *i = items ; i ; i = i->next ) { - sp_object_ref((SPObject *)i->data, NULL); + sp_object_ref(static_cast<SPItem *>(i->data), NULL); } for (GSList const *i = items; i != NULL; i = i->next) { - SPItem *item = reinterpret_cast<SPItem *>(i->data); + SPItem *item = static_cast<SPItem *>(i->data); item->deleteObject(propagate, propagate_descendants); sp_object_unref(item, NULL); } @@ -403,11 +403,11 @@ void sp_selection_delete(SPDesktop *desktop) return; } - GSList const *selected = g_slist_copy(const_cast<GSList *>(selection->itemList())); + GSList *selected = g_slist_copy(const_cast<GSList *>(selection->itemList())); selection->clear(); sp_selection_delete_impl(selected); - g_slist_free(const_cast<GSList *>(selected)); - reinterpret_cast<SPObject *>(desktop->currentLayer())->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG); + g_slist_free(selected); + desktop->currentLayer()->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG); /* a tool may have set up private information in it's selection context * that depends on desktop items. I think the only sane way to deal with @@ -2879,17 +2879,13 @@ void sp_selection_to_marker(SPDesktop *desktop, bool apply) _("Objects to marker")); } -static void sp_selection_to_guides_recursive(SPItem *item, bool deleteitem, bool wholegroups) { +static void sp_selection_to_guides_recursive(SPItem *item, bool wholegroups) { if (SP_IS_GROUP(item) && !SP_IS_BOX3D(item) && !wholegroups) { for (GSList *i = sp_item_group_item_list(SP_GROUP(item)); i != NULL; i = i->next) { - sp_selection_to_guides_recursive(SP_ITEM(i->data), deleteitem, wholegroups); + sp_selection_to_guides_recursive(static_cast<SPItem*>(i->data), wholegroups); } } else { item->convert_to_guides(); - - if (deleteitem) { - item->deleteObject(true); - } } } @@ -2909,13 +2905,24 @@ void sp_selection_to_guides(SPDesktop *desktop) } Inkscape::Preferences *prefs = Inkscape::Preferences::get(); - bool deleteitem = !prefs->getBool("/tools/cvg_keep_objects", 0); + bool deleteitems = !prefs->getBool("/tools/cvg_keep_objects", 0); bool wholegroups = prefs->getBool("/tools/cvg_convert_whole_groups", 0); + // If an object is earlier in the selection list than its clone, and it is deleted, then the clone will have changed + // and its entry in the selection list is invalid (crash). + // Therefore: first convert all, then delete all. + for (GSList const *i = items; i != NULL; i = i->next) { - sp_selection_to_guides_recursive(SP_ITEM(i->data), deleteitem, wholegroups); + sp_selection_to_guides_recursive(static_cast<SPItem*>(i->data), wholegroups); } + if (deleteitems) { + selection->clear(); + sp_selection_delete_impl(items); + } + + g_slist_free(items); + DocumentUndo::done(doc, SP_VERB_EDIT_SELECTION_2_GUIDES, _("Objects to guides")); } diff --git a/src/ui/dialog/ocaldialogs.cpp b/src/ui/dialog/ocaldialogs.cpp index ca0edfadd..417df9a27 100644 --- a/src/ui/dialog/ocaldialogs.cpp +++ b/src/ui/dialog/ocaldialogs.cpp @@ -16,13 +16,14 @@ # include <config.h> #endif +#include "ocaldialogs.h" + #include <stdio.h> // rename() #include <unistd.h> // close() #include <errno.h> // errno #include <string.h> // strerror() #include "path-prefix.h" -#include "ocaldialogs.h" #include "filedialogimpl-gtkmm.h" #include "interface.h" #include "gc-core.h" |
