]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Code improvement: 'myIsResetCurrentValue', 'myIsMouseOverWindow' are removed.
authornds <nds@opencascade.com>
Fri, 16 Oct 2015 05:39:17 +0000 (08:39 +0300)
committernds <nds@opencascade.com>
Mon, 2 Nov 2015 09:40:55 +0000 (12:40 +0300)
src/ModuleBase/ModuleBase_IModule.cpp
src/PartSet/PartSet_Module.cpp
src/PartSet/PartSet_SketcherMgr.cpp
src/PartSet/PartSet_SketcherMgr.h
src/XGUI/XGUI_OperationMgr.cpp

index 4e1718da3ca8bdb351e630e557a28a596a1d2ff9..3cbe89b5b4569b9970d29541b6cf10d410f037c0 100644 (file)
@@ -184,11 +184,6 @@ bool ModuleBase_IModule::canRedo() const
   return aMgr->hasModuleDocument() && aMgr->canRedo() && !aMgr->isOperation();
 }
 
-/*/bool ModuleBase_IModule::canCommitOperation() const
-{
-  return true;
-}*/
-
 void ModuleBase_IModule::onFeatureTriggered()
 {
   QAction* aCmd = dynamic_cast<QAction*>(sender());
index 70c7410691443c9761d742fd0c50c75193efb371..ce68a0c8d21d31d68ef592cfa6cc2774af8c2255 100755 (executable)
@@ -376,11 +376,6 @@ bool PartSet_Module::canApplyAction(const ObjectPtr& theObject, const QString& t
   return aValid;
 }
 
-/*bool PartSet_Module::canCommitOperation() const
-{
-  return mySketchMgr->canCommitOperation();
-}*/
-
 bool PartSet_Module::canEraseObject(const ObjectPtr& theObject) const
 {
   // the sketch manager put the restriction to the objects erase
index f89de6f2d3836a46082064650b8800d14577c8dd..60e578113fe61aeda1eb25af564537a073661eaa 100755 (executable)
@@ -75,7 +75,6 @@
 #include <QApplication>
 
 //#define DEBUG_DO_NOT_BY_ENTER
-//#define DEBUG_MOUSE_OVER_WINDOW_FLAGS
 
 /// Returns list of unique objects by sum of objects from List1 and List2
 /*QList<ModuleBase_ViewerPrs> getSumList(const QList<ModuleBase_ViewerPrs>& theList1,
@@ -152,7 +151,7 @@ void getAttributesOrResults(const Handle(SelectMgr_EntityOwner)& theOwner,
 
 PartSet_SketcherMgr::PartSet_SketcherMgr(PartSet_Module* theModule)
   : QObject(theModule), myModule(theModule), myIsDragging(false), myDragDone(false),
-    /*myIsResetCurrentValue(false), */myIsMouseOverWindow(false),
+    myIsMouseOverWindow(false),
     myIsMouseOverViewProcessed(true), myPreviousUpdateViewerEnabled(true),
     myIsPopupMenuActive(false), myIsConstraintsShown(true)
 {
@@ -191,14 +190,6 @@ void PartSet_SketcherMgr::onEnterViewPort()
   // the mouse move and use the cursor position to update own values. If the presentaion is
   // redisplayed before this update, the feature presentation jumps from reset value to current.
   myIsMouseOverWindow = true;
-  //myIsResetCurrentValue = false;
-  //myIsCurrentValueUnderModification = false;
-  // it is important to validate operation here only if sketch entity create operation is active
-  // because at this operation we reacts to the mouse leave/enter view port
-  //operationMgr()->onValidateOperation();
-#ifdef DEBUG_MOUSE_OVER_WINDOW_FLAGS
-  qDebug(QString("onEnterViewPort: %1").arg(mouseOverWindowFlagsInfo()).toStdString().c_str());
-#endif
 
   #ifdef DEBUG_DO_NOT_BY_ENTER
   return;
@@ -234,9 +225,6 @@ void PartSet_SketcherMgr::onLeaveViewPort()
   // it is important to validate operation here only if sketch entity create operation is active
   // because at this operation we reacts to the mouse leave/enter view port
   //operationMgr()->onValidateOperation();
-#ifdef DEBUG_MOUSE_OVER_WINDOW_FLAGS
-  qDebug(QString("onLeaveViewPort: %1").arg(mouseOverWindowFlagsInfo()).toStdString().c_str());
-#endif
 
   #ifdef DEBUG_DO_NOT_BY_ENTER
   return;
@@ -262,9 +250,8 @@ void PartSet_SketcherMgr::onLeaveViewPort()
   // obtained after reset value
   bool isEnableUpdateViewer = aDisplayer->enableUpdateViewer(false);
   ModuleBase_ModelWidget* anActiveWidget = getActiveWidget();
-  if (anActiveWidget && anActiveWidget->reset()) {
-    //myIsResetCurrentValue = true;
-  }
+  if (anActiveWidget)
+    anActiveWidget->reset();
   aDisplayer->enableUpdateViewer(isEnableUpdateViewer);
 
   // hides the presentation of the current operation feature
@@ -280,12 +267,6 @@ void PartSet_SketcherMgr::onLeaveViewPort()
 
 void PartSet_SketcherMgr::onValueStateChanged()
 {
-  ///myIsCurrentValueUnderModification = true;
-  // update Apply enable state
-  //myIsResetCurrentValue = false;
-  //if (!isNestedCreateOperation(getCurrentOperation()))
-  //  return;
-
   ModuleBase_ModelWidget* anActiveWidget = getActiveWidget();
   if (anActiveWidget && anActiveWidget->getValueState() != ModuleBase_ModelWidget::Stored)
     operationMgr()->onValidateOperation();
@@ -293,9 +274,6 @@ void PartSet_SketcherMgr::onValueStateChanged()
 
 void PartSet_SketcherMgr::onBeforeValuesChangedInPropertyPanel()
 {
-  //myIsResetCurrentValue = false;
-  //myIsCurrentValueUnderModification = false;
-
   if (isNestedCreateOperation(getCurrentOperation()))
     return;
   // it is necessary to save current selection in order to restore it after the values are modifed
@@ -330,8 +308,6 @@ void PartSet_SketcherMgr::onValuesChangedInPropertyPanel()
   if (!isNestedCreateOperation(getCurrentOperation()))
     return;
 
-  // visualize the current operation feature
-  //myIsResetCurrentValue = false;
   operationMgr()->onValidateOperation();
   // the feature is to be erased here, but it is correct to call canDisplayObject because
   // there can be additional check (e.g. editor widget in distance constraint)
@@ -716,28 +692,6 @@ QString PartSet_SketcherMgr::getFeatureError(const FeaturePtr& theFeature)
     AttributeStringPtr aAttributeString = aSketch->string(SketchPlugin_Sketch::SOLVER_ERROR());
     anError = aAttributeString->value().c_str();
   }
-  /*else if (myIsResetCurrentValue /*|| myIsCurrentValueUnderModification*+/) {
-    // this flags do not allow commit of the current operation
-    ModuleBase_OperationFeature* aFOperation = dynamic_cast<ModuleBase_OperationFeature*>
-                                                                        (getCurrentOperation());
-    if (aFOperation) {
-      FeaturePtr aFeature = aFOperation->feature();
-      if (aFeature.get() && aFeature == theFeature && isNestedCreateOperation(aFOperation)) {
-        QString anAttributeName = "";
-        ModuleBase_ModelWidget* anActiveWidget = getActiveWidget();
-        if (anActiveWidget) {
-          AttributePtr anAttr = aFeature->attribute(anActiveWidget->attributeID());
-          if (anAttr.get())
-            anAttributeName = anAttr->id().c_str();
-        }
-        if (myIsResetCurrentValue)
-          anError = "Attribute \"" + anAttributeName + "\" is not initialized.";
-        //else if (myIsCurrentValueUnderModification) {
-        //  anError = "Attribute \"" + anAttributeName + "\" modification is not applyed. Please click \"Enter\" or \"Tab\".";
-        //}
-      }
-    }
-  }*/
   else {
     ModuleBase_ModelWidget* anActiveWidget = getActiveWidget();
     if (anActiveWidget) {
@@ -904,9 +858,7 @@ void PartSet_SketcherMgr::stopSketch(ModuleBase_Operation* theOperation)
 {
   myIsMouseOverWindow = false;
   myIsConstraintsShown = true;
-#ifdef DEBUG_MOUSE_OVER_WINDOW_FLAGS
-  qDebug(QString("stopSketch: %1").arg(mouseOverWindowFlagsInfo()).toStdString().c_str());
-#endif
+
   XGUI_ModuleConnector* aConnector = dynamic_cast<XGUI_ModuleConnector*>(myModule->workshop());
 
   DataPtr aData = myCurrentSketch->data();
@@ -974,8 +926,6 @@ void PartSet_SketcherMgr::startNestedSketch(ModuleBase_Operation* theOperation)
 void PartSet_SketcherMgr::stopNestedSketch(ModuleBase_Operation* theOp)
 {
   connectToPropertyPanel(false);
-  //myIsResetCurrentValue = false;
-  //myIsCurrentValueUnderModification = false;
   myIsMouseOverViewProcessed = true;
   operationMgr()->onValidateOperation();
   if (isNestedCreateOperation(theOp))
@@ -1008,17 +958,6 @@ bool PartSet_SketcherMgr::canRedo() const
   return isNestedCreateOperation(getCurrentOperation());
 }
 
-/*bool PartSet_SketcherMgr::canCommitOperation() const
-{
-  bool aCanCommit = true;
-
-  if (isNestedCreateOperation(getCurrentOperation()) &&
-      (myIsResetCurrentValue || myIsCurrentValueUnderModification))
-    aCanCommit = false;
-
-  return aCanCommit;
-}*/
-
 bool PartSet_SketcherMgr::canEraseObject(const ObjectPtr& theObject) const
 {
   bool aCanErase = true;
@@ -1116,14 +1055,10 @@ bool PartSet_SketcherMgr::canDisplayCurrentCreatedFeature() const
   bool aCanDisplay = myIsMouseOverWindow;
   if (!aCanDisplay) {
     ModuleBase_ModelWidget* anActiveWidget = getActiveWidget();
-    bool isValueStored = anActiveWidget && anActiveWidget->getValueState() == ModuleBase_ModelWidget::Stored;
-    aCanDisplay = /*!myIsResetCurrentValue &&*/isValueStored;
+    if (anActiveWidget)
+      aCanDisplay = anActiveWidget->getValueState() == ModuleBase_ModelWidget::Stored;
   }
   return aCanDisplay;
-  //return myIsMouseOverWindow || (!myIsResetCurrentValue && !myIsCurrentValueUnderModification);
-#ifdef DEBUG_MOUSE_OVER_WINDOW_FLAGS
-  qDebug(QString("canDisplayCurrentCreatedFeature: %1").arg(mouseOverWindowFlagsInfo()).toStdString().c_str());
-#endif
 }
 
 bool PartSet_SketcherMgr::isObjectOfSketch(const ObjectPtr& theObject) const
@@ -1417,12 +1352,6 @@ void PartSet_SketcherMgr::onShowConstraintsToggle(bool theOn)
   Events_Loop::loop()->flush(Events_Loop::eventByName(EVENT_OBJECT_TO_REDISPLAY));
 }
 
-QString PartSet_SketcherMgr::mouseOverWindowFlagsInfo() const
-{
-  return "";//QString("myIsResetCurrentValue = %1,    myIsMouseOverWindow = %2")
-     //.arg(myIsResetCurrentValue).arg(myIsMouseOverWindow);
-}
-
 XGUI_OperationMgr* PartSet_SketcherMgr::operationMgr() const
 {
   ModuleBase_IWorkshop* anIWorkshop = myModule->workshop();
index 44cbca6d56652574969b483764b99d4d7ff2e4ad..d2a5226ed2a18e3c6be5f0ccb691ea7b58f05aef 100644 (file)
@@ -291,10 +291,6 @@ private:
   void visualizeFeature(const FeaturePtr& theFeature, const bool isEditOperation,
                         const bool isToDisplay, const bool isFlushRedisplay = true);
 private:
-  /// Gives a debug information about internal flags myIsMouseOverWindow and myIsResetCurrentValue
-  /// \return a string value
-  QString mouseOverWindowFlagsInfo() const;
-
   XGUI_OperationMgr* operationMgr() const;
 
 private:
@@ -303,8 +299,6 @@ private:
   bool myPreviousDrawModeEnabled; // the previous selection enabled state in the viewer
   bool myIsDragging;
   bool myDragDone;
-  bool myIsResetCurrentValue; /// the state that value in the property panel is reset
-  //bool myIsCurrentValueUnderModification; /// the value is modified in PP but it is not applyed in the model
   bool myIsMouseOverWindow; /// the state that the mouse over the view
   bool myIsMouseOverViewProcessed; /// the state whether the over view state is processed by mouseMove method
   bool myIsPopupMenuActive; /// the state of the popup menu is shown
index 119e3607823d6c7e1395b235f41ee9c56775ae2a..0410fce4929933d21c64c8a53aa197802a1f0986 100644 (file)
@@ -192,14 +192,10 @@ void XGUI_OperationMgr::onValidateOperation()
 {
   if (!hasOperation())
     return;
-  //ModuleBase_Operation* anOperation = currentOperation();
   ModuleBase_OperationFeature* aFOperation = dynamic_cast<ModuleBase_OperationFeature*>
                                                                           (currentOperation());
-  if(aFOperation && aFOperation->feature().get()) {
-    //bool aCanCommit = myWorkshop->module()->canCommitOperation();
-    //setApplyEnabled(!myIsValidationLock && aCanCommit && anOperation->isValid());
+  if(aFOperation && aFOperation->feature().get())
     setApplyEnabled(myWorkshop->module()->getFeatureError(aFOperation->feature()).isEmpty());
-  }
 }
 
 void XGUI_OperationMgr::setLockValidating(bool toLock)