From 83eedba0436d4034ea772fa4486f07fb1763e03b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20Tr=C3=B6ger?= Date: Mon, 27 Jul 2015 20:31:18 +0200 Subject: [PATCH] crossreferences only with ctrl button and fix missing return value --- src/App/DocumentObject.cpp | 1 - src/Mod/Sketcher/App/SketchObject.cpp | 6 ++---- src/Mod/Sketcher/Gui/CommandCreateGeo.cpp | 4 +++- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/App/DocumentObject.cpp b/src/App/DocumentObject.cpp index 0bc64d993..f4447ea06 100644 --- a/src/App/DocumentObject.cpp +++ b/src/App/DocumentObject.cpp @@ -175,7 +175,6 @@ DocumentObjectGroup* DocumentObject::getGroup() const bool DocumentObject::testIfLinkDAGCompatible(DocumentObject *linkTo) const { std::vector linkTo_in_vector; - linkTo_in_vector.reserve(1); linkTo_in_vector.push_back(linkTo); return this->testIfLinkDAGCompatible(linkTo_in_vector); } diff --git a/src/Mod/Sketcher/App/SketchObject.cpp b/src/Mod/Sketcher/App/SketchObject.cpp index fa3964b9b..f24c556ce 100644 --- a/src/Mod/Sketcher/App/SketchObject.cpp +++ b/src/Mod/Sketcher/App/SketchObject.cpp @@ -1719,15 +1719,14 @@ bool SketchObject::isExternalAllowed(App::Document *pDoc, App::DocumentObject *p if (!(this->testIfLinkDAGCompatible(pObj))){ if (rsn) *rsn = rlCircularReference; - return false - ; + return false; } } catch (Base::Exception &e) { Base::Console().Warning("Probably, there is a circular reference in the document. Error: %s\n", e.what()); return true; //prohibiting this reference won't remove the problem anyway... } + - /* // Note: Checking for the body of the support doesn't work when the support are the three base planes App::DocumentObject *support = this->Support.getValue(); Part::BodyBase* body = Part::BodyBase::findBodyOf(this); @@ -1745,7 +1744,6 @@ bool SketchObject::isExternalAllowed(App::Document *pDoc, App::DocumentObject *p } return true; - */ } int SketchObject::addSymmetric(const std::vector &geoIdList, int refGeoId, Sketcher::PointPos refPosId/*=Sketcher::none*/) diff --git a/src/Mod/Sketcher/Gui/CommandCreateGeo.cpp b/src/Mod/Sketcher/Gui/CommandCreateGeo.cpp index 3d1a79dd4..e9db6b982 100644 --- a/src/Mod/Sketcher/Gui/CommandCreateGeo.cpp +++ b/src/Mod/Sketcher/Gui/CommandCreateGeo.cpp @@ -4475,6 +4475,8 @@ namespace SketcherGui { bool allow(App::Document *pDoc, App::DocumentObject *pObj, const char *sSubName) { Sketcher::SketchObject *sketch = static_cast(object); + sketch->allowOtherBody = (QApplication::keyboardModifiers() == Qt::ControlModifier); + Sketcher::SketchObject::eReasonList msg; if (!sketch->isExternalAllowed(pDoc, pObj, &msg)){ switch(msg){ @@ -4485,7 +4487,7 @@ namespace SketcherGui { this->notAllowedReason = QT_TR_NOOP("This object is in another document."); break; case Sketcher::SketchObject::rlOtherPart: - this->notAllowedReason = QT_TR_NOOP("This object belongs to another part, can't link."); + this->notAllowedReason = QT_TR_NOOP("This object belongs to another part or body, can't link. Hold Ctrl to allow crossreferences."); break; } return false;