From b45c1dbb8462b7dc1f3bb0130cb642987d2b9ce1 Mon Sep 17 00:00:00 2001 From: wmayer Date: Tue, 21 May 2013 13:42:08 +0200 Subject: [PATCH] Allow to delete sub-elements in either case --- src/Gui/CommandDoc.cpp | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/src/Gui/CommandDoc.cpp b/src/Gui/CommandDoc.cpp index 3588e77d0..db858e01c 100644 --- a/src/Gui/CommandDoc.cpp +++ b/src/Gui/CommandDoc.cpp @@ -1030,19 +1030,23 @@ void StdCmdDelete::activated(int iMsg) // check if we can delete the object for (std::vector::iterator ft = sel.begin(); ft != sel.end(); ++ft) { App::DocumentObject* obj = ft->getObject(); - std::vector links = obj->getInList(); - if (!links.empty()) { - // check if the referenced objects are groups or are selected too - for (std::vector::iterator lt = links.begin(); lt != links.end(); ++lt) { - if (!(*lt)->getTypeId().isDerivedFrom(App::DocumentObjectGroup::getClassTypeId()) && !rSel.isSelected(*lt)) { - doDeletion = false; + Gui::ViewProvider* vp = pGuiDoc->getViewProvider(ft->getObject()); + // if the object is in edit mode we allow to continue because only sub-elements will be removed + if (!vp || !vp->isEditing()) { + std::vector links = obj->getInList(); + if (!links.empty()) { + // check if the referenced objects are groups or are selected too + for (std::vector::iterator lt = links.begin(); lt != links.end(); ++lt) { + if (!(*lt)->getTypeId().isDerivedFrom(App::DocumentObjectGroup::getClassTypeId()) && !rSel.isSelected(*lt)) { + doDeletion = false; + break; + } + } + + if (!doDeletion) { break; } } - - if (!doDeletion) { - break; - } } }