]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Issue #612 - Sketch abort have to be confirmed.
authornds <natalia.donis@opencascade.com>
Tue, 7 Jul 2015 14:52:54 +0000 (17:52 +0300)
committernds <natalia.donis@opencascade.com>
Tue, 7 Jul 2015 14:55:11 +0000 (17:55 +0300)
src/ModuleBase/ModuleBase_Operation.cpp
src/PartSet/PartSet_SketcherMgr.cpp
src/XGUI/XGUI_OperationMgr.cpp

index cf100595efe0acd4e3850e2fa07fe6738bfbf1df..c54130b4800a441922773f4a0a5b6d41786d23d0 100644 (file)
@@ -233,13 +233,7 @@ bool ModuleBase_Operation::commit()
       myCurrentFeature = FeaturePtr();
     }
     commitOperation();
-    // check whether there are modifications performed during the current operation
-    // in the model
-    // in case if there are no modifications, do not increase the undo/redo stack
-    if (aMgr->isModified())
-      aMgr->finishOperation();
-    else
-      aMgr->abortOperation();
+    aMgr->finishOperation();
 
     stopOperation();
     emit stopped();
index 7bc472b75af7f53bd393582965de105d785fca5b..891703b8e17ac324e83a707a5a7461ff59ee4658 100644 (file)
@@ -463,10 +463,10 @@ void PartSet_SketcherMgr::onMouseMoved(ModuleBase_IViewWindow* theWnd, QMouseEve
     ModuleBase_IViewer* aViewer = myModule->workshop()->viewer();
     aViewer->enableSelection(false);
 
-    ModuleBase_Operation* aOperation = getCurrentOperation();
-    if (!aOperation)
+    ModuleBase_Operation* aCurrentOperation = getCurrentOperation();
+    if (!aCurrentOperation)
       return;
-    if (isSketchOperation(aOperation))
+    if (isSketchOperation(aCurrentOperation))
       return; // No edit operation activated
 
     Handle(V3d_View) aView = theWnd->v3dView();
@@ -489,6 +489,7 @@ void PartSet_SketcherMgr::onMouseMoved(ModuleBase_IViewWindow* theWnd, QMouseEve
     FeatureToSelectionMap::const_iterator anIt = myCurrentSelection.begin(),
                                           aLast = myCurrentSelection.end();
     // 4. the features and attributes modification(move)
+    bool isModified = false;
     for (; anIt != aLast; anIt++) {
       FeaturePtr aFeature = anIt.key();
 
@@ -509,6 +510,7 @@ void PartSet_SketcherMgr::onMouseMoved(ModuleBase_IViewWindow* theWnd, QMouseEve
             if (aPoint.get() != NULL) {
               bool isImmutable = aPoint->setImmutable(true);
               aPoint->move(dX, dY);
+              isModified = true;
               ModelAPI_EventCreator::get()->sendUpdated(aFeature, aMoveEvent);
               aPoint->setImmutable(isImmutable);
             }
@@ -520,10 +522,15 @@ void PartSet_SketcherMgr::onMouseMoved(ModuleBase_IViewWindow* theWnd, QMouseEve
           std::dynamic_pointer_cast<SketchPlugin_Feature>(aFeature);
         if (aSketchFeature) {
           aSketchFeature->move(dX, dY);
+          isModified = true;
           ModelAPI_EventCreator::get()->sendUpdated(aSketchFeature, aMoveEvent);
         }
       }
     }
+    // the modified state of the current operation should be updated if there are features, which
+    // were changed here
+    if (isModified)
+      aCurrentOperation->onValuesChanged();
     Events_Loop::loop()->flush(aMoveEvent); // up all move events - to be processed in the solver
     //Events_Loop::loop()->flush(aUpdateEvent); // up update events - to redisplay presentations
 
index fc45ef3f8052088dfc84793265fb7bd591d5dabf..b5579b88c70dc9039863dce28cdef98da28658a9 100644 (file)
@@ -276,14 +276,14 @@ void XGUI_OperationMgr::onOperationResumed()
 void XGUI_OperationMgr::onOperationStopped()
 {
   ModuleBase_Operation* aSenderOperation = dynamic_cast<ModuleBase_Operation*>(sender());
-  ModuleBase_Operation* anOperation = currentOperation();
-  if (!aSenderOperation || !anOperation || aSenderOperation != anOperation)
+  ModuleBase_Operation* aCurrentOperation = currentOperation();
+  if (!aSenderOperation || !aCurrentOperation || aSenderOperation != aCurrentOperation)
     return;
 
-  myOperations.removeAll(anOperation);
-  anOperation->deleteLater();
+  myOperations.removeAll(aCurrentOperation);
+  aCurrentOperation->deleteLater();
 
-  emit operationStopped(anOperation);
+  emit operationStopped(aCurrentOperation);
 
   // get last operation which can be resumed
   ModuleBase_Operation* aResultOp = 0;
@@ -297,6 +297,8 @@ void XGUI_OperationMgr::onOperationStopped()
     }
   }
   if (aResultOp) {
+    bool isModified = aCurrentOperation->isModified();
+    aResultOp->setIsModified(isModified);
     resumeOperation(aResultOp);
     onValidateOperation();
   }