Salome HOME
Change color of ellipse and elliptic arc when a sketch is fully constrained.
[modules/shaper.git] / src / PartSet / PartSet_WidgetFeaturePointSelector.cpp
index cd98c423c2d4201a774f4ff185d923b1ec7da1d4..f44ca020954120fcca6e350e97f48e3fe0d9514a 100644 (file)
@@ -1,8 +1,21 @@
-// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
-
-// File:        PartSet_WidgetFeaturePointSelector.cpp
-// Created:     28 Feb 2017
-// Author:      Natalia ERMOLAEVA
+// 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
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// 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
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
 
 #include <Config_WidgetAPI.h>
 
@@ -72,14 +85,14 @@ bool PartSet_WidgetFeaturePointSelector::isValidSelection(
 }
 
 //********************************************************************
-bool PartSet_WidgetFeaturePointSelector::activateSelectionAndFilters(bool toActivate)
+void PartSet_WidgetFeaturePointSelector::updateSelectionModesAndFilters(bool toActivate)
 {
 #ifdef HIGHLIGHT_STAYS_PROBLEM
   Handle(AIS_InteractiveContext) aContext =
                             XGUI_Tools::workshop(myWorkshop)->viewer()->AISContext();
   Quantity_Color aColor;
-  Handle(Graphic3d_HighlightStyle) aHStyle = aContext->HighlightStyle();
-  Handle(Graphic3d_HighlightStyle) aSStyle = aContext->SelectionStyle();
+  Handle(Prs3d_Drawer) aHStyle = aContext->HighlightStyle();
+  Handle(Prs3d_Drawer) aSStyle = aContext->SelectionStyle();
   if (toActivate) {
     std::vector<int> aColors;
     aColors = Config_PropManager::color("Visualization", "sketch_entity_color");
@@ -99,7 +112,7 @@ bool PartSet_WidgetFeaturePointSelector::activateSelectionAndFilters(bool toActi
 
 #endif
 
-  return ModuleBase_WidgetShapeSelector::activateSelectionAndFilters(toActivate);
+  ModuleBase_WidgetShapeSelector::updateSelectionModesAndFilters(toActivate);
 }
 
 //********************************************************************
@@ -161,9 +174,12 @@ void PartSet_WidgetFeaturePointSelector::mouseReleased(ModuleBase_IViewWindow* t
 
   updateObject(feature());
 
-  emit focusOutWidget(this);
   // we need to deselect base feature for better visibility of selected feature
   XGUI_Tools::workshop(myWorkshop)->displayer()->clearSelected(false);
+
+  // focusOutWidget should be the last functionality in the method because after this emit,
+  // the widget may be deleted and members of this class are deleted (e.g. myWorkshop)
+  emit focusOutWidget(this);
 }
 
 //********************************************************************