Salome HOME
Issue #905 Update of invalid feature representation in property panel
[modules/shaper.git] / src / XGUI / XGUI_OperationMgr.cpp
index 229801de9664c36f3b383a1716fc703d01a4bb04..efc2ce9d51237e4490d6a8803b3243843bed21ad 100644 (file)
@@ -9,6 +9,7 @@
 #include "ModuleBase_Operation.h"
 #include "ModuleBase_IWorkshop.h"
 #include "ModuleBase_IModule.h"
+#include <ModuleBase_IViewer.h>
 #include "ModuleBase_OperationDescription.h"
 #include "ModuleBase_OperationFeature.h"
 
@@ -290,12 +291,13 @@ bool XGUI_OperationMgr::isGrantedOperation(ModuleBase_Operation* theOperation)
   return isGranted;
 }
 
-bool XGUI_OperationMgr::canStartOperation(QString theId)
+bool XGUI_OperationMgr::canStartOperation(const QString& theId, const bool isAdditionallyGranted)
 {
   bool aCanStart = true;
   ModuleBase_Operation* aCurrentOp = currentOperation();
   if (aCurrentOp) {
-    if (!aCurrentOp->isGranted(theId)) {
+    bool aGranted = aCurrentOp->isGranted(theId) || isAdditionallyGranted;
+    if (!aGranted) {
       if (canStopOperation(aCurrentOp)) {
         if (myIsApplyEnabled && aCurrentOp->isModified())
           aCurrentOp->commit();
@@ -411,6 +413,20 @@ bool XGUI_OperationMgr::onKeyReleased(QKeyEvent* theEvent)
       emit keyEnterReleased();
       commitOperation();
     }
+    case Qt::Key_N:
+    case Qt::Key_P: {
+      bool noModifiers = (theEvent->modifiers() == Qt::NoModifier);
+      if (noModifiers) {
+        ModuleBase_IViewer* aViewer = myWorkshop->viewer();
+        Handle(AIS_InteractiveContext) aContext = aViewer->AISContext();
+        Handle(V3d_View) aView = aViewer->activeView();
+        if ((theEvent->key() == Qt::Key_N))
+          aContext->HilightNextDetected(aView);
+        else if ((theEvent->key() == Qt::Key_P))
+          aContext->HilightPreviousDetected(aView);
+      }
+    }
+
     break;
     default:
       isAccepted = false;