Salome HOME
It removes commented not used code.
[modules/shaper.git] / src / XGUI / XGUI_Workshop.cpp
index 3e1eff31c320ec4fdf51f7022522796bb920e683..5f7303a78a29de2cf1a78ba4bdb4661282c790ca 100755 (executable)
 #include <dlfcn.h>
 #endif
 
+
+QString XGUI_Workshop::MOVE_TO_END_COMMAND = QObject::tr("Move to the end");
+
 //#define DEBUG_DELETE
 
 XGUI_Workshop::XGUI_Workshop(XGUI_SalomeConnector* theConnector)
@@ -160,8 +163,6 @@ XGUI_Workshop::XGUI_Workshop(XGUI_SalomeConnector* theConnector)
           SLOT(onOperationCommitted(ModuleBase_Operation*)));
   connect(myOperationMgr, SIGNAL(operationAborted(ModuleBase_Operation*)), 
           SLOT(onOperationAborted(ModuleBase_Operation*)));
-  //connect(myOperationMgr, SIGNAL(validationStateChanged(bool)), 
-  //        myErrorMgr, SLOT(onValidationStateChanged()));
 
 #ifndef HAVE_SALOME
   connect(myMainWindow, SIGNAL(exitKeySequence()), SLOT(onExit()));
@@ -393,21 +394,6 @@ void XGUI_Workshop::onAcceptActionClicked()
   }
 }
 
-//******************************************************
-/*void XGUI_Workshop::onValidationStateChanged(bool theEnabled)
-{
-  XGUI_OperationMgr* anOperationMgr = operationMgr();
-  if (anOperationMgr) {
-    ModuleBase_OperationFeature* aFOperation = dynamic_cast<ModuleBase_OperationFeature*>
-                                                    (anOperationMgr->currentOperation());
-    if (aFOperation) {
-      QAction* anAction = myActionsMgr->operationStateAction(XGUI_ActionsMgr::Accept);
-      myErrorMgr->updateActionState(anAction, aFOperation->feature(), theEnabled);
-    }
-  }
-}*/
-
-
 //******************************************************
 void XGUI_Workshop::deactivateActiveObject(const ObjectPtr& theObject, const bool theUpdateViewer)
 {
@@ -804,14 +790,18 @@ void XGUI_Workshop::onUndo(int theTimes)
 {
   objectBrowser()->treeView()->setCurrentIndex(QModelIndex());
   SessionPtr aMgr = ModelAPI_Session::get();
+  std::list<std::string> aUndoList = aMgr->undoList();
   if (aMgr->isOperation()) {
     /// this is important for nested operations
     /// when sketch operation is active, this condition is false and
     /// the sketch operation is not aborted
     operationMgr()->onAbortOperation();
   }
-  for (int i = 0; i < theTimes; ++i) {
+  std::list<std::string>::const_iterator aIt = aUndoList.cbegin();
+  for (int i = 0; (i < theTimes) && (aIt != aUndoList.cend()); ++i, ++aIt) {
     aMgr->undo();
+    if (QString((*aIt).c_str()) == MOVE_TO_END_COMMAND)
+      myObjectBrowser->rebuildDataTree();
   }
 
   operationMgr()->updateApplyOfOperations();
@@ -829,14 +819,18 @@ void XGUI_Workshop::onRedo(int theTimes)
 
   objectBrowser()->treeView()->setCurrentIndex(QModelIndex());
   SessionPtr aMgr = ModelAPI_Session::get();
+  std::list<std::string> aRedoList = aMgr->redoList();
   if (aMgr->isOperation()) {
     /// this is important for nested operations
     /// when sketch operation is active, this condition is false and
     /// the sketch operation is not aborted
     operationMgr()->onAbortOperation();
   }
-  for (int i = 0; i < theTimes; ++i) {
+  std::list<std::string>::const_iterator aIt = aRedoList.cbegin();
+  for (int i = 0; (i < theTimes) && (aIt != aRedoList.cend()); ++i, ++aIt) {
     aMgr->redo();
+    if (QString((*aIt).c_str()) == MOVE_TO_END_COMMAND)
+      myObjectBrowser->rebuildDataTree();
   }
   operationMgr()->updateApplyOfOperations();
   updateCommandStatus();
@@ -1051,8 +1045,6 @@ void XGUI_Workshop::createDockWidgets()
 
   connect(myPropertyPanel, SIGNAL(enterClicked()),
           myOperationMgr,  SLOT(onProcessEnter()));
-  //connect(myOperationMgr,  SIGNAL(validationStateChanged(bool)),
-  //        this, SLOT(onValidationStateChanged(bool)));
 }
 
 //******************************************************
@@ -1068,8 +1060,8 @@ void XGUI_Workshop::showPropertyPanel()
   // in order to operation manager could process key events of the panel.
   // otherwise they are ignored. It happens only if the same(activateWindow) is
   // not happened by property panel activation(e.g. resume operation of Sketch)
-  myPropertyPanel->activateWindow();
-  myPropertyPanel->setFocus();
+  ModuleBase_Tools::activateWindow(myPropertyPanel, "XGUI_Workshop::showPropertyPanel()");
+  ModuleBase_Tools::setFocus(myPropertyPanel, "XGUI_Workshop::showPropertyPanel()");
 }
 
 //******************************************************
@@ -1088,8 +1080,8 @@ void XGUI_Workshop::hidePropertyPanel()
   // are processed by this console. For example Undo actions.
   // It is possible that this code is to be moved to NewGeom package
   QMainWindow* aDesktop = desktop();
-  aDesktop->activateWindow();
-  aDesktop->setFocus();
+  ModuleBase_Tools::activateWindow(aDesktop, "XGUI_Workshop::hidePropertyPanel()");
+  ModuleBase_Tools::setFocus(aDesktop, "XGUI_Workshop::showPropertyPanel()");
 }
 
 //******************************************************