Salome HOME
Issue #2998: Add help description for automatic creation of constraints
[modules/shaper.git] / src / XGUI / XGUI_SelectionActivate.cpp
index f8a1aaa886926bfa3c60f26475e4899bd70a9653..10b1d84e5711f80688e74293a18063176e00669a 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2017  CEA/DEN, EDF R&D
+// Copyright (C) 2014-2019  CEA/DEN, EDF R&D
 //
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
 //
 // You should have received a copy of the GNU Lesser General Public
 // License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 //
-// See http://www.salome-platform.org/ or
-// email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
 
 #include "XGUI_SelectionActivate.h"
 //#define DEBUG_ACTIVATE_AIS
 //#define DEBUG_DEACTIVATE_AIS
 
+#ifdef TINSPECTOR
+#include <inspector/VInspectorAPI_CallBack.hxx>
+#endif
+
 #define CLEAR_OUTDATED_SELECTION_BEFORE_REDISPLAY
 
 //**************************************************************
@@ -333,11 +336,19 @@ void XGUI_SelectionActivate::activateAIS(const Handle(AIS_InteractiveObject)& th
   }
   if (!aContext.IsNull()) {
     if (myWorkshop->module()) {
-      int aMode = (theMode > 8)? theMode : AIS_Shape::SelectionType(theMode);
+      // the code is obsolete, used in additional check before activate, it was removed
+      //int aMode = (theMode > 8)? theMode : AIS_Shape::SelectionType(theMode);
       aContext->Activate(theIO, theMode, false);
-    } else
+#ifdef TINSPECTOR
+      if (getDisplayer()->getCallBack()) getDisplayer()->getCallBack()->Activate(theIO, theMode);
+#endif
+    }
+    else {
       aContext->Activate(theIO, theMode, false);
-
+#ifdef TINSPECTOR
+      if (getDisplayer()->getCallBack()) getDisplayer()->getCallBack()->Activate(theIO, theMode);
+#endif
+    }
     // the fix from VPA for more suitable selection of sketcher lines
     if (theIO->Width() > 1) {
       double aPrecision = theIO->Width() + 2;
@@ -538,14 +549,16 @@ void XGUI_SelectionActivate::deactivateTrihedron(const bool theUpdateViewer) con
 void XGUI_SelectionActivate::deactivateTrihedronInSelectionModes()
 {
   Handle(AIS_InteractiveContext) aContext = AISContext();
-  Handle(AIS_Trihedron) aTrihedron = Handle(AIS_Trihedron)::DownCast(getTrihedron());
-  /// deactivate trihedron in selection modes
-  TColStd_ListOfInteger aTColModes;
-  aContext->ActivatedModes(aTrihedron, aTColModes);
-  TColStd_ListIteratorOfListOfInteger itr( aTColModes );
-  for (; itr.More(); itr.Next() ) {
-    Standard_Integer aMode = itr.Value();
-    aContext->Deactivate(aTrihedron, aMode);
+  if (!aContext.IsNull()) {
+    Handle(AIS_Trihedron) aTrihedron = Handle(AIS_Trihedron)::DownCast(getTrihedron());
+    /// deactivate trihedron in selection modes
+    TColStd_ListOfInteger aTColModes;
+    aContext->ActivatedModes(aTrihedron, aTColModes);
+    TColStd_ListIteratorOfListOfInteger itr(aTColModes);
+    for (; itr.More(); itr.Next()) {
+      Standard_Integer aMode = itr.Value();
+      aContext->Deactivate(aTrihedron, aMode);
+    }
   }
 }