Salome HOME
Within Issue #143 small corrections in sketch label's margins
[modules/shaper.git] / src / PartSet / PartSet_OperationSketchBase.cpp
index 9272c8c9e6c8dd48dc84c8e59c51b20d6b6df01e..9dd3141eb50135b8836616dde205871b20884857 100644 (file)
@@ -50,20 +50,16 @@ std::list<FeaturePtr> PartSet_OperationSketchBase::subFeatures() const
 
 std::list<int> PartSet_OperationSketchBase::getSelectionModes(ObjectPtr theFeature) const
 {
+  //TODO: Define position of selection modes definition
   std::list<int> aModes;
-  //FeaturePtr aFeature = boost::dynamic_pointer_cast<ModelAPI_Feature>(theFeature);
-  //if (aFeature) {
-  //  if (PartSet_Tools::isConstraintFeature(aFeature->getKind())) {
-  //      aModes.clear();
-  //      aModes.push_back(AIS_DSM_Text);
-  //      aModes.push_back(AIS_DSM_Line);
-  //      return aModes;
-  //  }
-  //}
-  aModes.push_back(AIS_Shape::SelectionMode((TopAbs_ShapeEnum) TopAbs_VERTEX));
-  aModes.push_back(AIS_Shape::SelectionMode((TopAbs_ShapeEnum) TopAbs_EDGE));
-  aModes.push_back(AIS_DSM_Text);
-  aModes.push_back(AIS_DSM_Line);
+  FeaturePtr aFeature = boost::dynamic_pointer_cast<ModelAPI_Feature>(theFeature);
+  if (aFeature && PartSet_Tools::isConstraintFeature(aFeature->getKind())) {
+    aModes.push_back(AIS_DSM_Text);
+    aModes.push_back(AIS_DSM_Line);
+  } else {
+    aModes.push_back(AIS_Shape::SelectionMode((TopAbs_ShapeEnum) TopAbs_VERTEX));
+    aModes.push_back(AIS_Shape::SelectionMode((TopAbs_ShapeEnum) TopAbs_EDGE));
+  }
   return aModes;
 }
 FeaturePtr PartSet_OperationSketchBase::createFeature(const bool theFlushMessage)
@@ -96,32 +92,6 @@ void PartSet_OperationSketchBase::mouseDoubleClick(
 {
 }
 
-void PartSet_OperationSketchBase::keyReleased(const int theKey)
-{
-  switch (theKey) {
-    case Qt::Key_Escape: {
-      bool toAbort = true;
-      if (isModified()) {
-        int anAnswer = QMessageBox::question(
-            qApp->activeWindow(), tr("Cancel operation"),
-            tr("Operation %1 will be cancelled. Continue?").arg(id()), QMessageBox::Yes,
-            QMessageBox::No);
-        toAbort = (anAnswer == QMessageBox::Yes);
-      }
-      if (toAbort)
-        abort();
-    }
-      break;
-    default:
-      break;
-  }
-}
-
-void PartSet_OperationSketchBase::keyReleased(std::string theName, QKeyEvent* theEvent)
-{
-  keyReleased(theEvent->key());
-}
-
 void PartSet_OperationSketchBase::restartOperation(const std::string& theType, ObjectPtr theFeature)
 {
   FeaturePtr aFeature = ModelAPI_Feature::feature(theFeature);
@@ -129,10 +99,10 @@ void PartSet_OperationSketchBase::restartOperation(const std::string& theType, O
     QStringList aNested = this->nestedFeatures();
     if (!aNested.isEmpty()) {
       if (aNested.contains(QString(aFeature->getKind().c_str()))) 
-        emit launchOperation(theType, theFeature);
+        emit restartRequired(theType, theFeature);
       else
         return;
     }
   }
-  emit launchOperation(theType, theFeature);
+  emit restartRequired(theType, theFeature);
 }