-// 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
//**************************************************************
break;
case FacesPanel: {
XGUI_Tools::workshop(myWorkshop)->facesPanel()->selectionModes(aModes);
- myWorkshop->module()->customSubShapesSelectionModes(aModes); // avoid wire selection
+ myWorkshop->module()->moduleSelectionModes(-1/*all modes*/, aModes);
}
break;
default: break;
{
SelectMgr_ListOfFilter aSelectionFilters;
switch (activeSelectionPlace()) {
- case Workshop:
- XGUI_Tools::workshop(myWorkshop)->selectionFilters(aSelectionFilters);
+ case Workshop: {
+ QIntList aModuleSelectionFilters = myWorkshop->module()->selectionFilters();
+ myWorkshop->module()->moduleSelectionFilters(aModuleSelectionFilters, aSelectionFilters);
+ }
break;
case PropertyPanel: {
+ QIntList aModuleSelectionFilters = myWorkshop->module()->selectionFilters();
+
ModuleBase_ModelWidget* anActiveWidget = myWorkshop->module()->activeWidget();
- getSelectionFilters(anActiveWidget, aSelectionFilters);
+ if (anActiveWidget)
+ anActiveWidget->selectionFilters(aModuleSelectionFilters, aSelectionFilters);
+ myWorkshop->module()->moduleSelectionFilters(aModuleSelectionFilters, aSelectionFilters);
}
break;
case FacesPanel: {
- //XGUI_Tools::workshop(myWorkshop)->selectionFilters(aSelectionFilters);
XGUI_Tools::workshop(myWorkshop)->facesPanel()->selectionFilters(aSelectionFilters);
+ //QIntList aModuleSelectionFilters = myWorkshop->module()->selectionFilters();
+ //myWorkshop->module()->moduleSelectionFilters(aModuleSelectionFilters, aSelectionFilters);
}
break;
default: break;
}
}
-//**************************************************************
-void XGUI_SelectionActivate::activateSelectionAndFilters(ModuleBase_ModelWidget* theWidget)
-{
- // activate selection modes
- QIntList aModes;
- getSelectionModes(theWidget, aModes);
- activateObjects(aModes, getDisplayer()->displayedObjects(), true);
-
- // activate selection filters
- SelectMgr_ListOfFilter aSelectionFilters;
- getSelectionFilters(theWidget, aSelectionFilters);
- activateSelectionFilters(aSelectionFilters);
-}
-
//**************************************************************
void XGUI_SelectionActivate::getSelectionModes(ModuleBase_ModelWidget* theWidget,
QIntList& theModes)
if (!theWidget)
return;
- bool isAdditional = false;
- theWidget->selectionModes(theModes, isAdditional);
- if (isAdditional) {
- myWorkshop->module()->customSubShapesSelectionModes(theModes);
- //theModes.append(XGUI_Tools::workshop(myWorkshop)->viewerSelectionModes());
- //myWorkshop->module()->activeSelectionModes(theModes);
- }
-}
-
-//**************************************************************
-void XGUI_SelectionActivate::getSelectionFilters(ModuleBase_ModelWidget* theWidget,
- SelectMgr_ListOfFilter& theSelectionFilters)
-{
- XGUI_Tools::workshop(myWorkshop)->selectionFilters(theSelectionFilters);
-
- if (theWidget)
- theWidget->selectionFilters(theSelectionFilters);
+ int aModuleSelectionModes = -1;
+ theWidget->selectionModes(aModuleSelectionModes, theModes);
+ myWorkshop->module()->moduleSelectionModes(aModuleSelectionModes, theModes);
}
//**************************************************************
}
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;
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);
+ }
}
}