From 73dd4ab9eb4a8eae88d67feb0e4acf2fa2408fd5 Mon Sep 17 00:00:00 2001 From: wmayer Date: Tue, 15 Nov 2011 10:04:21 +0000 Subject: [PATCH] + respect Selectable property in SoFCUnifiedSelection node git-svn-id: https://free-cad.svn.sourceforge.net/svnroot/free-cad/trunk@5136 e8eeb9e2-ec13-0410-a4a9-efa5cf37419d --- src/Gui/SoFCUnifiedSelection.cpp | 4 ++-- src/Gui/ViewProviderGeometryObject.h | 2 ++ src/Mod/Sketcher/Gui/ViewProviderSketch.cpp | 8 ++++++++ src/Mod/Sketcher/Gui/ViewProviderSketch.h | 2 +- 4 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/Gui/SoFCUnifiedSelection.cpp b/src/Gui/SoFCUnifiedSelection.cpp index c740a9662..056581483 100644 --- a/src/Gui/SoFCUnifiedSelection.cpp +++ b/src/Gui/SoFCUnifiedSelection.cpp @@ -250,7 +250,7 @@ void SoFCUnifiedSelection::doAction(SoAction *action) App::Document* doc = App::GetApplication().getDocument(selaction->SelChange.pDocName); App::DocumentObject* obj = doc->getObject(selaction->SelChange.pObjectName); ViewProvider*vp = Application::Instance->getViewProvider(obj); - if (vp && vp->useNewSelectionModel()) { + if (vp && vp->useNewSelectionModel() && vp->isSelectable()) { SoSelectionElementAction::Type type = SoSelectionElementAction::None; if (selaction->SelChange.Type == SelectionChanges::AddSelection) type = SoSelectionElementAction::All; @@ -269,7 +269,7 @@ void SoFCUnifiedSelection::doAction(SoAction *action) for (std::vector::iterator it = vps.begin(); it != vps.end(); ++it) { ViewProviderDocumentObject* vpd = static_cast(*it); if (vpd->useNewSelectionModel()) { - if (Selection().isSelected(vpd->getObject())) { + if (Selection().isSelected(vpd->getObject()) && vpd->isSelectable()) { SoSelectionElementAction action(SoSelectionElementAction::All); action.setColor(this->colorSelection.getValue()); action.apply(vpd->getRoot()); diff --git a/src/Gui/ViewProviderGeometryObject.h b/src/Gui/ViewProviderGeometryObject.h index c9eda6f3f..114bdcbfc 100644 --- a/src/Gui/ViewProviderGeometryObject.h +++ b/src/Gui/ViewProviderGeometryObject.h @@ -68,6 +68,8 @@ public: void updateData(const App::Property*); SoFCSelection* getHighlightNode() const { return pcHighlight; } + bool isSelectable(void) const {return Selectable.getValue();} + /** * Returns a list of picked points from the geometry under \a pcHighlight. * If \a pickAll is false (the default) only the intersection point closest to the camera will be picked, otherwise diff --git a/src/Mod/Sketcher/Gui/ViewProviderSketch.cpp b/src/Mod/Sketcher/Gui/ViewProviderSketch.cpp index 788169aa4..949df1e77 100644 --- a/src/Mod/Sketcher/Gui/ViewProviderSketch.cpp +++ b/src/Mod/Sketcher/Gui/ViewProviderSketch.cpp @@ -1012,6 +1012,14 @@ Base::Vector3d ViewProviderSketch::seekConstraintPosition(const Base::Vector3d & return freePos; } +bool ViewProviderSketch::isSelectable(void) const +{ + if (isEditing()) + return false; + else + return PartGui::ViewProvider2DObject::isSelectable(); +} + void ViewProviderSketch::onSelectionChanged(const Gui::SelectionChanges& msg) { // are we in edit? diff --git a/src/Mod/Sketcher/Gui/ViewProviderSketch.h b/src/Mod/Sketcher/Gui/ViewProviderSketch.h index bd32a0134..b97ea8493 100644 --- a/src/Mod/Sketcher/Gui/ViewProviderSketch.h +++ b/src/Mod/Sketcher/Gui/ViewProviderSketch.h @@ -87,7 +87,7 @@ public: void drawEdit(const std::vector &EditCurve); /// Is the view provider selectable - bool isSelectable(void) const {return !isEditing();} + bool isSelectable(void) const; /// Observer message from the Selection virtual void onSelectionChanged(const Gui::SelectionChanges& msg);