Salome HOME
Issue #3095: Import Part: provide list of parts if any
[modules/shaper.git] / src / XGUI / XGUI_Workshop.cpp
old mode 100755 (executable)
new mode 100644 (file)
index 735d8d5..6a17667
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2017  CEA/DEN, EDF R&D
+// Copyright (C) 2014-2019  CEA/DEN, EDF R&D
 //
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
 //
 // You should have received a copy of the GNU Lesser General Public
 // License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 //
-// See http://www.salome-platform.org/ or
-// email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
 
 #include "XGUI_Workshop.h"
@@ -46,7 +45,6 @@
 #include "XGUI_Tools.h"
 #include "XGUI_ViewerProxy.h"
 #include "XGUI_WorkshopListener.h"
-#include <XGUI_CustomPrs.h>
 #include <XGUI_HistoryMenu.h>
 #include <XGUI_QtEvents.h>
 #include <XGUI_DataModel.h>
@@ -68,6 +66,7 @@
 #include <ModelAPI_AttributeDocRef.h>
 #include <ModelAPI_AttributeIntArray.h>
 #include <ModelAPI_AttributeDouble.h>
+#include <ModelAPI_AttributeString.h>
 #include <ModelAPI_Data.h>
 #include <ModelAPI_Events.h>
 #include <ModelAPI_Feature.h>
@@ -80,6 +79,7 @@
 #include <ModelAPI_Session.h>
 #include <ModelAPI_Validator.h>
 #include <ModelAPI_Tools.h>
+#include <ModelAPI_ResultField.h>
 
 //#include <PartSetPlugin_Part.h>
 
 #include <Events_InfoMessage.h>
 #include <Events_LongOp.h>
 
+#include <ExchangePlugin_ExportPart.h>
+#include <ExchangePlugin_ImportPart.h>
+
+#include <GeomAPI_Pnt.h>
+
 #include <ModuleBase_IModule.h>
 #include <ModuleBase_IViewer.h>
 #include <ModuleBase_Operation.h>
 #include <ModuleBase_Tools.h>
 #include <ModuleBase_WidgetFactory.h>
 #include <ModuleBase_OperationFeature.h>
-#include <ModuleBase_OperationAction.h>
 #include <ModuleBase_PagedContainer.h>
 #include <ModuleBase_WidgetValidated.h>
 #include <ModuleBase_ModelWidget.h>
 #include <ModuleBase_ResultPrs.h>
 #include <ModuleBase_ActionIntParameter.h>
+#include <ModuleBase_IStepPrs.h>
 
 #include <Config_Common.h>
 #include <Config_FeatureMessage.h>
@@ -170,8 +175,17 @@ QString XGUI_Workshop::MOVE_TO_END_COMMAND = QObject::tr("Move to the end");
 //#define DEBUG_FEATURE_NAME
 //#define DEBUG_CLEAN_HISTORY
 
+#ifdef HAVE_SALOME
+static QString MyFilter(QObject::tr("SHAPER files (*.shaper *.cadbld)"));
+static QString MyFilter2(QObject::tr("SHAPER files (*.shaper)"));
+static QString MyExtension(".shaper");
+#else
+static QString MyFilter(QObject::tr("CAD Builder files (*.cadbld);;All files (*.*)"));
+static QString MyFilter2(QObject::tr("CAD Builder files (*.cadbld)"));
+static QString MyExtension(".cadbld");
+#endif
 
-static QString MyFilter(QObject::tr("OpenParts files (*.opp)"));
+static QString MyImportPartFilter(QObject::tr("Part files (*.shaperpart);;All files (*.*)"));
 
 
 //******************************************************
@@ -258,27 +272,14 @@ XGUI_Workshop::XGUI_Workshop(XGUI_SalomeConnector* theConnector)
 
 #ifndef HAVE_SALOME
   connect(myMainWindow, SIGNAL(exitKeySequence()), SLOT(onExit()));
-  onTrihedronVisibilityChanged(true);
+  myDisplayer->displayTrihedron(true);
 #endif
 
   connect(myEventsListener, SIGNAL(errorOccurred(std::shared_ptr<Events_InfoMessage>)),
           myErrorDlg, SLOT(addError(std::shared_ptr<Events_InfoMessage>)));
 
-  //Config_PropManager::registerProp("Visualization", "object_default_color", "Object color",
-  //                                 Config_Prop::Color, "225,225,225");
-
-  Config_PropManager::registerProp("Visualization", "result_body_color", "Result color",
-                                   Config_Prop::Color, ModelAPI_ResultBody::DEFAULT_COLOR());
-  Config_PropManager::registerProp("Visualization", "result_group_color", "Group color",
-                                   Config_Prop::Color, ModelAPI_ResultGroup::DEFAULT_COLOR());
-  Config_PropManager::registerProp("Visualization", "result_construction_color",
-                                   "Construction color",
-                                   Config_Prop::Color,
-                                   ModelAPI_ResultConstruction::DEFAULT_COLOR());
-  Config_PropManager::registerProp("Visualization", "result_part_color", "Part color",
-                                   Config_Prop::Color, ModelAPI_ResultPart::DEFAULT_COLOR());
-  Config_PropManager::registerProp("Visualization", "result_field_color", "Field color",
-                                   Config_Prop::Color, ModelAPI_ResultField::DEFAULT_COLOR());
+  Config_PropManager::registerProp("Visualization", "selection_color", "Selection color",
+    Config_Prop::Color, "255,255,255");
 
   if (ModuleBase_Preferences::resourceMgr()->booleanValue("Viewer", "face-selection", true))
     myViewerSelMode.append(TopAbs_FACE);
@@ -303,6 +304,8 @@ XGUI_Workshop::~XGUI_Workshop(void)
 
   delete myDisplayer;
   delete myDataModelXMLReader;
+  delete mySelectionActivate;
+  delete myMenuMgr;
   clearTemporaryDir();
 }
 
@@ -334,6 +337,15 @@ void XGUI_Workshop::startApplication()
   // Calling of  loadCustomProps before activating module is required
   // by Config_PropManger to restore user-defined path to plugins
   ModuleBase_Preferences::loadCustomProps();
+  std::vector<int> aColor;
+  try {
+    aColor = Config_PropManager::color("Visualization", "selection_color");
+  }
+  catch (...) {
+  }
+  if (aColor.size() == 3)
+    myDisplayer->setSelectionColor(aColor);
+
   createModule();
 
 #ifndef HAVE_SALOME
@@ -433,13 +445,13 @@ void XGUI_Workshop::initMenu()
 
   salomeConnector()->addDesktopMenuSeparator("MEN_DESK_EDIT");
 
-  aAction = salomeConnector()->addDesktopCommand("AUTOCOMPUTE_CMD", tr("Block auto-apply"),
-                                              tr("Blocks immediate apply of modifications"),
-                                              QIcon(":pictures/autoapply.png"), QKeySequence(),
-                                              true, "MEN_DESK_EDIT");
-  salomeConnector()->addActionInToolbar( aAction, aToolBarTitle );
+  //aAction = salomeConnector()->addDesktopCommand("AUTOCOMPUTE_CMD", tr("Auto rebuild"),
+  //                                            tr("Blocks immediate apply of modifications"),
+  //                                            QIcon(":pictures/autoapply.png"), QKeySequence(),
+  //                                            false, "MEN_DESK_EDIT");
+  //salomeConnector()->addActionInToolbar( aAction, aToolBarTitle );
 
-  connect(aAction, SIGNAL(toggled(bool)), this, SLOT(onAutoApply(bool)));
+  //connect(aAction, SIGNAL(triggered(bool)), this, SLOT(onAutoApply()));
 
   salomeConnector()->addDesktopMenuSeparator("MEN_DESK_EDIT");
 
@@ -458,6 +470,19 @@ void XGUI_Workshop::initMenu()
   connect(aAction, SIGNAL(triggered(bool)), this, SLOT(onOpen()));
   salomeConnector()->addDesktopMenuSeparator("MEN_DESK_FILE");
 
+  aAction = salomeConnector()->addDesktopCommand("EXPORT_PART_CMD", tr("Export part..."),
+                                          tr("Export a part of the current document into a file"),
+                                          QIcon(), QKeySequence(),
+                                          false, "MEN_DESK_FILE");
+  connect(aAction, SIGNAL(triggered(bool)), this, SLOT(onExportPart()));
+
+  aAction = salomeConnector()->addDesktopCommand("IMPORT_PART_CMD", tr("Import part..."),
+                                          tr("Import structure of a part"),
+                                          QIcon(), QKeySequence(),
+                                          false, "MEN_DESK_FILE");
+  connect(aAction, SIGNAL(triggered(bool)), this, SLOT(onImportPart()));
+  salomeConnector()->addDesktopMenuSeparator("MEN_DESK_FILE");
+
 #else
   // File commands group
   AppElements_MenuGroupPanel* aGroup = myMainWindow->menuObject()->generalPage();
@@ -499,7 +524,7 @@ void XGUI_Workshop::initMenu()
   aCommand = aGroup->addFeature("AUTOCOMPUTE_CMD", tr("Auto rebuild"),
                                 tr("Blocks immediate apply of modifications"),
                                 QIcon(":pictures/autoapply_start.png"), QKeySequence());
-  //aCommand->setChecked(ModelAPI_Session::get()->isAutoUpdateBlocked());
+  aCommand->setChecked(ModelAPI_Session::get()->isAutoUpdateBlocked());
   aCommand->connectTo(this, SLOT(onAutoApply()));
 
   aCommand = aGroup->addFeature("PREF_CMD", tr("Preferences"), tr("Edit preferences"),
@@ -612,7 +637,7 @@ void XGUI_Workshop::onHelpActionClicked()
             "salome" + aSep + "gui" + aSep + "SHAPER";
         }
 #else
-        QString aDir(getenv("OPENPARTS_ROOT_DIR"));
+        QString aDir(getenv("CADBUILDER_ROOT_DIR"));
         aDocDir = aDir + aSep + "doc" + aSep + "gui";
 #endif
         QString aFileName = aDocDir + aSep + aHelpPage;
@@ -664,12 +689,11 @@ void XGUI_Workshop::fillPropertyPanel(ModuleBase_Operation* theOperation)
   if (!aFOperation)
     return;
 
-  showPanel(myPropertyPanel);
   myPropertyPanel->cleanContent();
 
   QList<ModuleBase_ModelWidget*> aWidgets;
-  if (!module()->createWidgets(theOperation, aWidgets)) {
-    QString aXmlRepr = aFOperation->getDescription()->xmlRepresentation();
+  QString aXmlRepr = aFOperation->getDescription()->xmlRepresentation();
+  if (!module()->createWidgets(aFOperation->feature(), aXmlRepr, aWidgets)) {
     ModuleBase_WidgetFactory aFactory(aXmlRepr.toStdString(), myModuleConnector);
     aFactory.createWidget(myPropertyPanel->contentWidget());
     aWidgets = aFactory.getModelWidgets();
@@ -740,15 +764,20 @@ void XGUI_Workshop::fillPropertyPanel(ModuleBase_Operation* theOperation)
   myModule->propertyPanelDefined(theOperation);
 
 #ifndef DEBUG_FEATURE_NAME
-  myPropertyPanel->setWindowTitle(theOperation->getDescription()->description());
+  myPropertyPanel->setWindowTitle(ModuleBase_Tools::translate("workshop",
+    theOperation->getDescription()->description().toStdString()));
 #else
   std::string aFeatureName = aFeature->name();
   myPropertyPanel->setWindowTitle(QString("%1: %2")
-    .arg(theOperation->getDescription()->description())
-    .arg(aFeatureName.c_str()));
+    .arg(translate(theOperation->getDescription()->description()))
+    .arg(translate(aFeatureName.c_str())));
 #endif
 
   myErrorMgr->setPropertyPanel(myPropertyPanel);
+  theOperation->setHideFacesVisible(myFacesPanel->isVisible());
+  if (aFeatureInfo.get() && aFeatureInfo->isHideFacesPanel() && !myFacesPanel->isVisible())
+    myFacesPanel->show();
+  showPanel(myPropertyPanel);
 }
 
 //******************************************************
@@ -781,6 +810,12 @@ void XGUI_Workshop::onOperationResumed(ModuleBase_Operation* theOperation)
   if (theOperation->getDescription()->hasXmlRepresentation()) {  //!< No need for property panel
     fillPropertyPanel(theOperation);
     connectToPropertyPanel(true);
+    ModuleBase_OperationFeature* aFOperation = dynamic_cast<ModuleBase_OperationFeature*>
+      (theOperation);
+    if (aFOperation)
+      myPropertyPanel->updateApplyPlusButton(aFOperation->feature());
+    else
+      myPropertyPanel->updateApplyPlusButton(FeaturePtr());
   }
   updateCommandStatus();
 
@@ -824,6 +859,9 @@ void XGUI_Workshop::onOperationStopped(ModuleBase_Operation* theOperation)
     }
   }
   activateObjectsSelection(anObjects);
+
+  if (!theOperation->isHideFacesVisible())
+    myFacesPanel->hide();
 }
 
 //******************************************************
@@ -908,7 +946,6 @@ void XGUI_Workshop::onOpen()
   //save current file before close if modified
   SessionPtr aSession = ModelAPI_Session::get();
   if (aSession->isModified()) {
-    //TODO(sbh): re-launch the app?
     int anAnswer = QMessageBox::question(
         desktop(), tr("Save current file"),
         tr("The document is modified, save before opening another?"),
@@ -922,7 +959,11 @@ void XGUI_Workshop::onOpen()
   }
 
   //show file dialog, check if readable and open
-  QString aFile = QFileDialog::getOpenFileName(desktop(), tr("Open file"), QString(), MyFilter);
+  qreal aRatio = ModuleBase_Tools::currentPixelRatio();
+  // If the ratio is > 1 (HD screen) then QT has a bug in
+  // displaying of system open file dialog (too small)
+  QString aFile = QFileDialog::getOpenFileName(desktop(), tr("Open file"), QString(), MyFilter,
+    Q_NULLPTR, ((aRatio > 1)? QFileDialog::DontUseNativeDialog : QFileDialog::Options()));
   if (!aFile.isNull())
     openFile(aFile);
 }
@@ -947,7 +988,8 @@ void XGUI_Workshop::openFile(const QString& theDirectory)
   aSession->closeAll();
 
   clearTemporaryDir();
-  XGUI_CompressFiles::uncompress(myCurrentFile, myTmpDir.path());
+  if (!XGUI_CompressFiles::uncompress(myCurrentFile, myTmpDir.path()))
+    return;
 
   aSession->load(myTmpDir.path().toLatin1().constData());
   myObjectBrowser->rebuildDataTree();
@@ -1029,8 +1071,7 @@ void XGUI_Workshop::onPreferences()
   ModuleBase_Preferences::editPreferences(aModif);
   if (aModif.size() > 0) {
     QString aSection;
-    foreach (ModuleBase_Pref aPref, aModif)
-    {
+    foreach (ModuleBase_Pref aPref, aModif) {
       aSection = aPref.first;
       if (aSection == ModuleBase_Preferences::VIEWER_SECTION) {
         myMainWindow->viewer()->updateFromResources();
@@ -1038,6 +1079,15 @@ void XGUI_Workshop::onPreferences()
         myMainWindow->menuObject()->updateFromResources();
       }
     }
+    std::vector<int> aColor;
+    try {
+      aColor = Config_PropManager::color("Visualization", "selection_color");
+    }
+    catch (...) {
+    }
+    if (aColor.size() == 3)
+      displayer()->setSelectionColor(aColor);
+
     displayer()->redisplayObjects();
   }
 }
@@ -1047,8 +1097,10 @@ void XGUI_Workshop::onPreferences()
 void XGUI_Workshop::onTrihedronVisibilityChanged(bool theState)
 {
   XGUI_Displayer* aDisplayer = displayer();
-  if (aDisplayer)
+  if (aDisplayer) {
     aDisplayer->displayTrihedron(theState);
+    aDisplayer->updateViewer();
+  }
 }
 
 //******************************************************
@@ -1064,14 +1116,23 @@ bool XGUI_Workshop::onSave()
     aMgr->blockAutoUpdate(false);
 
   std::list<std::string> aFiles;
-  saveDocument(myTmpDir.path(), aFiles);
-  XGUI_CompressFiles::compress(myCurrentFile, aFiles);
+  // issue #2899: create a temporary directory, save and then remove it
+#ifdef HAVE_SALOME
+  std::string aTmpDir = XGUI_Tools::getTmpDirByEnv("SALOME_TMP_DIR");
+#else
+  std::string aTmpDir = XGUI_Tools::getTmpDirByEnv("");
+#endif
+  saveDocument(QString(aTmpDir.c_str()), aFiles);
+  bool aResult = XGUI_CompressFiles::compress(myCurrentFile, aFiles);
+  XGUI_Tools::removeTemporaryFiles(aTmpDir, aFiles);
 
-  updateCommandStatus();
+  if (aResult) {
+    updateCommandStatus();
 #ifndef HAVE_SALOME
     myMainWindow->setModifiedState(false);
 #endif
-  return true;
+  }
+  return aResult;
 }
 
 //******************************************************
@@ -1079,13 +1140,17 @@ bool XGUI_Workshop::onSaveAs()
 {
   if(!myOperationMgr->abortAllOperations(XGUI_OperationMgr::XGUI_InformationMessage))
     return false;
+  qreal aRatio = ModuleBase_Tools::currentPixelRatio();
   myCurrentFile = QFileDialog::getSaveFileName(desktop(), tr("Select name to save file..."),
-    QString(), MyFilter);
+    QString(), MyFilter2,
+    Q_NULLPTR, ((aRatio > 1) ? QFileDialog::DontUseNativeDialog : QFileDialog::Options()));
   if (!myCurrentFile.isNull()) {
-    if (!myCurrentFile.endsWith(".opp")) {
-      myCurrentFile += ".opp";
+    if (!myCurrentFile.endsWith(MyExtension)) {
+      myCurrentFile += MyExtension;
     }
   }
+  else
+    return false;
 #ifndef HAVE_SALOME
     myMainWindow->setCurrentDir(myCurrentFile, false);
     myMainWindow->setModifiedState(false);
@@ -1202,6 +1267,27 @@ void XGUI_Workshop::onValuesChanged()
 void XGUI_Workshop::onWidgetObjectUpdated()
 {
   operationMgr()->onValidateOperation();
+  myDisplayer->updateViewer();
+}
+
+//******************************************************
+void XGUI_Workshop::onImportPart()
+{
+  if (abortAllOperations()) {
+    ModuleBase_OperationFeature* anImportPartOp = dynamic_cast<ModuleBase_OperationFeature*>(
+        module()->createOperation(ExchangePlugin_ImportPart::ID()));
+    operationMgr()->startOperation(anImportPartOp);
+  }
+}
+
+//******************************************************
+void XGUI_Workshop::onExportPart()
+{
+  if (abortAllOperations()) {
+    ModuleBase_OperationFeature* anExportPartOp = dynamic_cast<ModuleBase_OperationFeature*>(
+        module()->createOperation(ExchangePlugin_ExportPart::ID()));
+    operationMgr()->startOperation(anExportPartOp);
+  }
 }
 
 //******************************************************
@@ -1319,7 +1405,6 @@ void XGUI_Workshop::updateCommandStatus()
           aCmd->setEnabled(myModule->canRedo());
       }
       else if (aId == "AUTOCOMPUTE_CMD") {
-        //aCmd->setChecked(aMgr->isAutoUpdateBlocked());
         aCmd->setIcon(aMgr->isAutoUpdateBlocked() ?
           QIcon(":pictures/autoapply_stop.png") :
           QIcon(":pictures/autoapply_start.png"));
@@ -1370,8 +1455,7 @@ QDockWidget* XGUI_Workshop::createObjectBrowser(QWidget* theParent)
 {
   QDockWidget* aObjDock = new QDockWidget(theParent);
   aObjDock->setAllowedAreas(Qt::LeftDockWidgetArea |
-                            Qt::RightDockWidgetArea |
-                            Qt::BottomDockWidgetArea);
+                            Qt::RightDockWidgetArea);
   aObjDock->setWindowTitle(tr("Object browser"));
   aObjDock->setStyleSheet(
       "::title { position: relative; padding-left: 5px; text-align: left center }");
@@ -1380,6 +1464,8 @@ QDockWidget* XGUI_Workshop::createObjectBrowser(QWidget* theParent)
   myModule->customizeObjectBrowser(myObjectBrowser);
   aObjDock->setWidget(myObjectBrowser);
 
+  connect(myObjectBrowser, SIGNAL(sizeChanged()), SLOT(onDockSizeChanged()));
+
   myContextMenuMgr->connectObjectBrowser();
   return aObjDock;
 }
@@ -1399,19 +1485,19 @@ void XGUI_Workshop::createDockWidgets()
 
   myPropertyPanel->setupActions(myActionsMgr);
   myPropertyPanel->setAllowedAreas(Qt::LeftDockWidgetArea |
-                                   Qt::RightDockWidgetArea |
-                                   Qt::BottomDockWidgetArea);
+                                   Qt::RightDockWidgetArea);
   aDesktop->addDockWidget(Qt::LeftDockWidgetArea, myPropertyPanel);
+
   hidePanel(myPropertyPanel);  ///<! Invisible by default
 
-  myFacesPanel = new XGUI_FacesPanel(aDesktop, myModuleConnector);
+  myFacesPanel = new XGUI_FacesPanel(aDesktop, this);
   myActiveControlMgr->addSelector(new XGUI_FacesPanelSelector(myFacesPanel));
   myFacesPanel->setAllowedAreas(Qt::LeftDockWidgetArea |
                                 Qt::RightDockWidgetArea |
                                 Qt::BottomDockWidgetArea);
   connect(myFacesPanel, SIGNAL(closed()), myFacesPanel, SLOT(onClosed()));
 
-  myInspectionPanel = new XGUI_InspectionPanel(aDesktop, mySelector);
+  myInspectionPanel = new XGUI_InspectionPanel(aDesktop, this);
   myInspectionPanel->setAllowedAreas(Qt::LeftDockWidgetArea |
     Qt::RightDockWidgetArea);
   aDesktop->addDockWidget(Qt::RightDockWidgetArea, myInspectionPanel);
@@ -1503,7 +1589,7 @@ void XGUI_Workshop::hidePanel(QDockWidget* theDockWidget)
   // the property panel is active window of the desktop, when it is
   // hidden, it is undefined which window becomes active. By this reason
   // it is defined to perform the desktop as the active window.
-  // in SALOME mode, workstack made the PyConsole the active window,
+  // in SALOME mode, work-stack made the PyConsole the active window,
   // set the focus on it. As a result, shortcuts of the application, like
   // are processed by this console. For example Undo actions.
   // It is possible that this code is to be moved to SHAPER package
@@ -1552,10 +1638,8 @@ void XGUI_Workshop::onContextMenuCommand(const QString& theId, bool isChecked)
     changeColor(aObjects);
   else if (theId == "DEFLECTION_CMD")
     changeDeflection(aObjects);
-#ifdef USE_TRANSPARENCY
   else if (theId == "TRANSPARENCY_CMD")
     changeTransparency(aObjects);
-#endif
   else if (theId == "SHOW_CMD") {
     showObjects(aObjects, true);
     mySelector->updateSelectionBy(ModuleBase_ISelection::Browser);
@@ -1613,6 +1697,10 @@ void XGUI_Workshop::onContextMenuCommand(const QString& theId, bool isChecked)
     highlightResults(aObjects);
   } else if (theId == "SHOW_FEATURE_CMD") {
     highlightFeature(aObjects);
+  } else if (theId == "SET_VIEW_NORMAL_CMD") {
+    setNormalView();
+  } else if (theId == "SET_VIEW_INVERTEDNORMAL_CMD") {
+    setNormalView(true);
   }
 #ifdef TINSPECTOR
   else if (theId == "TINSPECTOR_VIEW") {
@@ -1757,6 +1845,7 @@ void XGUI_Workshop::deleteObjects()
   // allow the module to delete objects, do nothing if it has succeed
   if (aModule->deleteObjects()) {
     updateCommandStatus();
+    myDisplayer->updateViewer();
     return;
   }
 
@@ -1772,9 +1861,24 @@ void XGUI_Workshop::deleteObjects()
   bool hasFolder = false;
   ModuleBase_Tools::checkObjects(anObjects, hasResult, hasFeature, hasParameter, hasCompositeOwner,
                                  hasResultInHistory, hasFolder);
-  if (!(hasFeature || hasParameter || hasFolder))
+  if (!(hasResult || hasFeature || hasParameter || hasFolder))
     return;
 
+  // Remove from the list non-deletable objects: infinite constructions which are not in history
+  bool notDelete = true;
+  QObjectPtrList::iterator aIt;
+  for (aIt = anObjects.begin(); aIt != anObjects.end(); aIt++) {
+    ObjectPtr aObj = (*aIt);
+    ResultConstructionPtr aConstr = std::dynamic_pointer_cast<ModelAPI_ResultConstruction>(aObj);
+    FeaturePtr aFeature = ModelAPI_Feature::feature(aObj);
+    if (aFeature) {
+      notDelete = (!aFeature->isInHistory()) && aConstr->isInfinite();
+      if (notDelete) {
+        anObjects.removeAll(aObj);
+        aIt--;
+      }
+    }
+  }
   // delete objects
   std::map<FeaturePtr, std::set<FeaturePtr> > aReferences;
   std::set<FeaturePtr> aFeatures;
@@ -1787,7 +1891,7 @@ void XGUI_Workshop::deleteObjects()
   bool aDone = false;
   QString aDescription = contextMenuMgr()->action("DELETE_CMD")->text() + " %1";
   aDescription = aDescription.arg(XGUI_Tools::unionOfObjectNames(anObjects, ", "));
-  ModuleBase_OperationAction* anOpAction = new ModuleBase_OperationAction(aDescription, module());
+  ModuleBase_Operation* anOpAction = new ModuleBase_Operation(aDescription, module());
 
   operationMgr()->startOperation(anOpAction);
 
@@ -1813,11 +1917,25 @@ void XGUI_Workshop::deleteObjects()
       }
     }
   }
+  // remove results selected
+  std::list<ResultPtr> aResults;
+  for(QObjectPtrList::const_iterator anIt = anObjects.begin(); anIt != anObjects.end(); anIt++) {
+    ResultPtr aRes = std::dynamic_pointer_cast<ModelAPI_Result>(*anIt);
+    if (aRes.get() && aRes->data()->isValid() && !aRes->data()->isDeleted() &&
+        aRes->groupName() != ModelAPI_ResultGroup::group() && // don't remove groups and fields
+        aRes->groupName() != ModelAPI_ResultField::group()) // because they are badly selected
+      aResults.push_back(aRes);
+  }
+  if (!aResults.empty()) {
+    ModelAPI_Tools::removeResults(aResults);
+  }
 
   if (aDone)
     operationMgr()->commitOperation();
   else
     operationMgr()->abortOperation(operationMgr()->currentOperation());
+
+  myDisplayer->updateViewer();
 }
 
 //**************************************************************
@@ -1867,11 +1985,11 @@ void XGUI_Workshop::cleanHistory()
   ModelAPI_Tools::findAllReferences(aFeatures, aReferences, true, false);
   // find for each object whether all reference values are in the map as key, that means that there
   // is no other reference in the model to this object, so it might be removed by cleaning history
-  // sk_1(ext_1, vertex_1) + (sk_3, bool_1) - cann't be deleted, dependency to bool_1
-  // ext_1(bool_1, sk_3)  - cann't be deleted, dependency to bool_1
+  // sk_1(ext_1, vertex_1) + (sk_3, bool_1) - can't be deleted, dependency to bool_1
+  // ext_1(bool_1, sk_3)  - can't be deleted, dependency to bool_1
   // vertex_1()
-  // sk_2(ext_2) + (bool_1)  - cann't be deleted, dependency to bool_1
-  // ext_2(bool_1)  - cann't be deleted, dependency to bool_1
+  // sk_2(ext_2) + (bool_1)  - can't be deleted, dependency to bool_1
+  // ext_2(bool_1)  - can't be deleted, dependency to bool_1
   // sk_3()
   // Information: bool_1 is not selected
   std::set<FeaturePtr> anUnusedObjects;
@@ -1911,7 +2029,8 @@ void XGUI_Workshop::cleanHistory()
     QString anUnusedNames = aNames.join(", ");
 
     QString anActionId = "CLEAN_HISTORY_CMD";
-    QString aDescription = contextMenuMgr()->action(anActionId)->text();
+    QString aDescription = ModuleBase_Tools::translate("workshop",
+        contextMenuMgr()->action(anActionId)->text().toStdString());
 
     QMessageBox aMessageBox(desktop());
     aMessageBox.setWindowTitle(aDescription);
@@ -1929,7 +2048,7 @@ void XGUI_Workshop::cleanHistory()
     // 1. start operation
     aDescription += "by deleting of " +
       aDescription.arg(XGUI_Tools::unionOfObjectNames(anObjects, ", "));
-    ModuleBase_OperationAction* anOpAction = new ModuleBase_OperationAction(aDescription, module());
+    ModuleBase_Operation* anOpAction = new ModuleBase_Operation(aDescription, module());
     operationMgr()->startOperation(anOpAction);
 
     // WORKAROUND, should be done before each object remove, if it presents in XGUI_DataModel tree
@@ -1968,6 +2087,10 @@ void XGUI_Workshop::cleanHistory()
 }
 
 //**************************************************************
+bool compareFeature(const FeaturePtr& theF1, const FeaturePtr& theF2) {
+  DocumentPtr aDoc = theF1->document();
+  return aDoc->index(theF1) < aDoc->index(theF2);
+}
 void XGUI_Workshop::moveObjects()
 {
   if (!abortAllOperations())
@@ -1975,10 +2098,6 @@ void XGUI_Workshop::moveObjects()
 
   SessionPtr aMgr = ModelAPI_Session::get();
 
-  QString anActionId = "MOVE_CMD";
-  QString aDescription = contextMenuMgr()->action(anActionId)->text();
-  aMgr->startOperation(aDescription.toStdString());
-
   QObjectPtrList anObjects = mySelector->selection()->selectedObjects();
   // It is necessary to clear selection in order to avoid selection changed event during
   // moving and negative consequences connected with processing of already moved items
@@ -1989,9 +2108,17 @@ void XGUI_Workshop::moveObjects()
   if (!XGUI_Tools::canRemoveOrRename(desktop(), aFeatures))
     return;
 
+  QString anActionId = "MOVE_CMD";
+  QString aDescription = contextMenuMgr()->action(anActionId)->text();
+  aMgr->startOperation(aDescription.toStdString());
+
+  // Sort features by index in document
+  std::list<FeaturePtr> aFList(aFeatures.begin(), aFeatures.end());
+  aFList.sort(compareFeature);
+
   DocumentPtr anActiveDocument = aMgr->activeDocument();
   FeaturePtr aCurrentFeature = anActiveDocument->currentFeature(true);
-  std::set<FeaturePtr>::const_iterator anIt = aFeatures.begin(), aLast = aFeatures.end();
+  std::list<FeaturePtr>::const_iterator anIt = aFList.begin(), aLast = aFList.end();
   for (; anIt != aLast; anIt++) {
     FeaturePtr aFeature = *anIt;
     if (!aFeature.get() || !myModule->canApplyAction(aFeature, anActionId))
@@ -2001,6 +2128,7 @@ void XGUI_Workshop::moveObjects()
     aCurrentFeature = anActiveDocument->currentFeature(true);
   }
   aMgr->finishOperation();
+  updateCommandStatus();
 }
 
 //**************************************************************
@@ -2170,11 +2298,8 @@ bool XGUI_Workshop::canBeShaded(const ObjectPtr& theObject) const
 bool XGUI_Workshop::canChangeProperty(const QString& theActionName) const
 {
   if (theActionName == "COLOR_CMD" ||
-      theActionName == "DEFLECTION_CMD"
-#ifdef USE_TRANSPARENCY
-      || theActionName == "TRANSPARENCY_CMD"
-#endif
-      ) {
+      theActionName == "DEFLECTION_CMD" ||
+      theActionName == "TRANSPARENCY_CMD") {
     QObjectPtrList aObjects = mySelector->selection()->selectedObjects();
 
     std::set<std::string> aTypes;
@@ -2203,6 +2328,9 @@ void setColor(ResultPtr theResult, const std::vector<int>& theColor)
     aColorAttr->setValue(1, theColor[1]);
     aColorAttr->setValue(2, theColor[2]);
   }
+  static const Events_ID kRedisplayEvent =
+    Events_Loop::loop()->eventByName(EVENT_OBJECT_TO_REDISPLAY);
+  ModelAPI_EventCreator::get()->sendUpdated(theResult, kRedisplayEvent);
 }
 
 //**************************************************************
@@ -2216,7 +2344,7 @@ void XGUI_Workshop::changeColor(const QObjectPtrList& theObjects)
   foreach(ObjectPtr anObject, theObjects) {
     ResultPtr aResult = std::dynamic_pointer_cast<ModelAPI_Result>(anObject);
     if (aResult.get()) {
-      XGUI_CustomPrs::getResultColor(aResult, aColor);
+      ModelAPI_Tools::getColor(aResult, aColor);
     }
     else {
       // TODO: remove the obtaining a color from the AIS object
@@ -2281,6 +2409,9 @@ void setDeflection(ResultPtr theResult, const double theDeflection)
   AttributeDoublePtr aDeflectionAttr = theResult->data()->real(ModelAPI_Result::DEFLECTION_ID());
   if (aDeflectionAttr.get() != NULL)
     aDeflectionAttr->setValue(theDeflection);
+  static const Events_ID kRedisplayEvent =
+    Events_Loop::loop()->eventByName(EVENT_OBJECT_TO_REDISPLAY);
+  ModelAPI_EventCreator::get()->sendUpdated(theResult, kRedisplayEvent);
 }
 
 //**************************************************************
@@ -2292,6 +2423,9 @@ void setTransparency(ResultPtr theResult, double theTransparency)
   AttributeDoublePtr anAttribute = theResult->data()->real(ModelAPI_Result::TRANSPARENCY_ID());
   if (anAttribute.get() != NULL)
     anAttribute->setValue(theTransparency);
+  static const Events_ID kRedisplayEvent =
+    Events_Loop::loop()->eventByName(EVENT_OBJECT_TO_REDISPLAY);
+  ModelAPI_EventCreator::get()->sendUpdated(theResult, kRedisplayEvent);
 }
 
 //**************************************************************
@@ -2323,7 +2457,7 @@ void XGUI_Workshop::changeDeflection(const QObjectPtrList& theObjects)
   foreach(ObjectPtr anObject, theObjects) {
     ResultPtr aResult = std::dynamic_pointer_cast<ModelAPI_Result>(anObject);
     if (aResult.get()) {
-      aDeflection = XGUI_CustomPrs::getResultDeflection(aResult);
+      aDeflection = ModelAPI_Tools::getDeflection(aResult);
     }
     else {
       // TODO: remove the obtaining a property from the AIS object
@@ -2386,17 +2520,7 @@ void XGUI_Workshop::changeTransparency(const QObjectPtrList& theObjects)
   foreach(ObjectPtr anObject, theObjects) {
     ResultPtr aResult = std::dynamic_pointer_cast<ModelAPI_Result>(anObject);
     if (aResult.get()) {
-      aCurrentValue = XGUI_CustomPrs::getResultTransparency(aResult);
-    }
-    else {
-      // TODO: remove the obtaining a property from the AIS object
-      // this does not happen never because:
-      // 1. The property can be changed only on results
-      // 2. The result can be not visualized in the viewer(e.g. Origin Construction)
-      AISObjectPtr anAISObj = myDisplayer->getAISObject(anObject);
-      if (anAISObj.get()) {
-        aCurrentValue = anAISObj->getDeflection();
-      }
+      aCurrentValue = ModelAPI_Tools::getTransparency(aResult);
     }
     if (aCurrentValue > 0)
       break;
@@ -2405,16 +2529,14 @@ void XGUI_Workshop::changeTransparency(const QObjectPtrList& theObjects)
     return;
 
   if (!abortAllOperations())
-  return;
+    return;
 
   // 2. show the dialog to change the value
   XGUI_PropertyDialog* aDlg = new XGUI_PropertyDialog(desktop());
-  aDlg->setWindowTitle("Transparency");
+  aDlg->setWindowTitle(tr("Transparency"));
   XGUI_TransparencyWidget* aTransparencyWidget = new XGUI_TransparencyWidget(aDlg);
   connect(aTransparencyWidget, SIGNAL(transparencyValueChanged()),
           this, SLOT(onTransparencyValueChanged()));
-  connect(aTransparencyWidget, SIGNAL(previewStateChanged()),
-          this, SLOT(onPreviewStateChanged()));
   aDlg->setContent(aTransparencyWidget);
   aTransparencyWidget->setValue(aCurrentValue);
 
@@ -2423,16 +2545,16 @@ void XGUI_Workshop::changeTransparency(const QObjectPtrList& theObjects)
   QString aDescription = contextMenuMgr()->action("TRANSPARENCY_CMD")->text();
   aMgr->startOperation(aDescription.toStdString());
 
-  aDlg->move(QCursor::pos());
-  bool isDone = aDlg->exec() == QDialog::Accepted;
-  if (!isDone)
-    return;
-
-  // 4. set the value to all results
-  aCurrentValue = aTransparencyWidget->getValue();
-  setTransparency(aCurrentValue, theObjects);
+  if (aDlg->exec() == QDialog::Accepted) {
+    // 4. set the value to all results
+    aCurrentValue = aTransparencyWidget->getValue();
+    setTransparency(aCurrentValue, theObjects);
+    aMgr->finishOperation();
+  } else {
+    aMgr->abortOperation();
+    Events_Loop::loop()->flush(Events_Loop::eventByName(EVENT_OBJECT_TO_REDISPLAY));
+  }
 
-  aMgr->finishOperation();
   updateCommandStatus();
 }
 
@@ -2440,7 +2562,7 @@ void XGUI_Workshop::changeTransparency(const QObjectPtrList& theObjects)
 void XGUI_Workshop::onTransparencyValueChanged()
 {
   XGUI_TransparencyWidget* aTransparencyWidget = (XGUI_TransparencyWidget*)sender();
-  if (!aTransparencyWidget || !aTransparencyWidget->isPreviewNeeded())
+  if (!aTransparencyWidget)
     return;
 
   QObjectPtrList anObjects = mySelector->selection()->selectedObjects();
@@ -2448,23 +2570,6 @@ void XGUI_Workshop::onTransparencyValueChanged()
   Events_Loop::loop()->flush(Events_Loop::eventByName(EVENT_OBJECT_TO_REDISPLAY));
 }
 
-//**************************************************************
-void XGUI_Workshop::onPreviewStateChanged()
-{
-  XGUI_TransparencyWidget* aTransparencyWidget = (XGUI_TransparencyWidget*)sender();
-  if (!aTransparencyWidget || !aTransparencyWidget->isPreviewNeeded())
-    return;
-
-  QObjectPtrList anObjects = mySelector->selection()->selectedObjects();
-  setTransparency(aTransparencyWidget->getValue(), anObjects);
-  Events_Loop::loop()->flush(Events_Loop::eventByName(EVENT_OBJECT_TO_REDISPLAY));
-}
-
-//**************************************************************
-#define SET_DISPLAY_GROUP(aGroupName, aDisplay) \
-for (int i = 0; i < aDoc->size(aGroupName); i++) { \
-  aDoc->object(aGroupName, i)->setDisplayed(aDisplay); \
-}
 
 //******************************************************
 void XGUI_Workshop::showObjects(const QObjectPtrList& theList, bool isVisible)
@@ -2483,6 +2588,9 @@ void XGUI_Workshop::showObjects(const QObjectPtrList& theList, bool isVisible)
   }
   Events_Loop::loop()->flush(Events_Loop::eventByName(EVENT_OBJECT_TO_REDISPLAY));
   myObjectBrowser->updateAllIndexes();
+
+  updateColorScaleVisibility();
+  displayer()->updateViewer();
 }
 
 //**************************************************************
@@ -2522,6 +2630,79 @@ void XGUI_Workshop::showOnlyObjects(const QObjectPtrList& theList)
 
   // Necessary for update icons in ObjectBrowser on Linux
   myObjectBrowser->updateAllIndexes();
+  updateColorScaleVisibility();
+  displayer()->updateViewer();
+}
+
+
+//**************************************************************
+void XGUI_Workshop::updateColorScaleVisibility()
+{
+  QObjectPtrList aObjects = mySelector->selection()->selectedObjects();
+  viewer()->setColorScaleShown(false);
+  if (aObjects.size() == 1) {
+    FieldStepPtr aStep =
+      std::dynamic_pointer_cast<ModelAPI_ResultField::ModelAPI_FieldStep>(aObjects.first());
+    if (aStep.get() && myDisplayer->isVisible(aStep)) {
+      AISObjectPtr aAisPtr = myDisplayer->getAISObject(aStep);
+      Handle(AIS_InteractiveObject) aIO = aAisPtr->impl<Handle(AIS_InteractiveObject)>();
+      ModuleBase_IStepPrs* aPrs = dynamic_cast<ModuleBase_IStepPrs*>(aIO.get());
+      if (aPrs) {
+        ModelAPI_AttributeTables::ValueType aType = aPrs->dataType();
+        if ((aType == ModelAPI_AttributeTables::DOUBLE) ||
+          (aType == ModelAPI_AttributeTables::INTEGER) ||
+          (aType == ModelAPI_AttributeTables::BOOLEAN)) {
+          myViewerProxy->setupColorScale();
+          if (aType == ModelAPI_AttributeTables::BOOLEAN) {
+            myViewerProxy->setColorScaleIntervals(2);
+            myViewerProxy->setColorScaleRange(0., 1.);
+          }
+          else {
+            double aMin, aMax;
+            aPrs->dataRange(aMin, aMax);
+            myViewerProxy->setColorScaleRange(aMin, aMax);
+          }
+          myViewerProxy->setColorScaleTitle(aStep->name().c_str());
+          myViewerProxy->setColorScaleShown(true);
+        }
+      }
+    }
+  }
+}
+
+
+//**************************************************************
+void XGUI_Workshop::setNormalView(bool toInvert)
+{
+  QList<ModuleBase_ViewerPrsPtr> aPrsList =
+    mySelector->selection()->getSelected(ModuleBase_ISelection::Viewer);
+  GeomShapePtr aPlanarFace;
+  foreach(ModuleBase_ViewerPrsPtr aPrs, aPrsList) {
+    GeomShapePtr aShape = aPrs->shape();
+    if (aShape.get() && aShape->isPlanar()) {
+      aPlanarFace = aShape;
+      break;
+    }
+  }
+  if (aPlanarFace.get()) {
+    GeomFacePtr aFace(new GeomAPI_Face(aPlanarFace));
+    GeomPlanePtr aPlane = aFace->getPlane();
+    GeomDirPtr aNormal = aPlane->direction();
+    if (toInvert)
+      aNormal->reverse();
+    GeomPointPtr aPos = aPlane->location();
+
+    double aXmin, aYmin, aZmin, aXmax, aYmax, aZmax;
+    aFace->computeSize(aXmin, aYmin, aZmin, aXmax, aYmax, aZmax);
+
+    Handle(V3d_View) aView = myViewerProxy->activeView();
+    double aScale = aView->Scale();
+    aView->SetAt(aPos->x(), aPos->y(), aPos->z());
+    aView->SetProj(aNormal->x(), aNormal->y(), aNormal->z());
+    Bnd_Box aBox;
+    aBox.Update(aXmin, aYmin, aZmin, aXmax, aYmax, aZmax);
+    aView->FitAll(aBox);
+  }
 }
 
 //**************************************************************
@@ -2658,34 +2839,66 @@ void XGUI_Workshop::synchronizeViewer()
   aDocs.append(aMgr->moduleDocument());
 
   foreach(DocumentPtr aDoc, aDocs) {
-    synchronizeGroupInViewer(aDoc, ModelAPI_ResultConstruction::group(), false);
-    synchronizeGroupInViewer(aDoc, ModelAPI_ResultBody::group(), false);
-    synchronizeGroupInViewer(aDoc, ModelAPI_ResultPart::group(), false);
-    synchronizeGroupInViewer(aDoc, ModelAPI_ResultGroup::group(), false);
+    synchronizeGroupInViewer(aDoc, false);
   }
 }
 
 //******************************************************
 void XGUI_Workshop::synchronizeGroupInViewer(const DocumentPtr& theDoc,
-                                             const std::string& theGroup,
                                              bool theUpdateViewer)
 {
-  ObjectPtr aObj;
-  int aSize = theDoc->size(theGroup);
+  FeaturePtr aFeature;
+  ResultPtr aRes;
+  int aSize = theDoc->numInternalFeatures();
   for (int i = 0; i < aSize; i++) {
-    aObj = theDoc->object(theGroup, i);
-    if (aObj->isDisplayed()) {
-      // Hide the presentation with an empty shape. But isDisplayed state of the object should not
-      // be changed to the object becomes visible when the shape becomes not empty
-      ResultPtr aRes = std::dynamic_pointer_cast<ModelAPI_Result>(aObj);
-      if (aRes.get() && (!aRes->shape().get() || aRes->shape()->isNull()))
-        continue;
-      myDisplayer->display(aObj, false);
+    aFeature = theDoc->internalFeature(i);
+    if (!aFeature.get())
+      continue;
+    const std::list<ResultPtr>& aResults = aFeature->results();
+    std::list<ResultPtr>::const_iterator aIt;
+    aFeature->setDisplayed(false);
+    for (aIt = aResults.cbegin(); aIt != aResults.cend(); aIt++) {
+      aRes = (*aIt);
+      if (aRes->isDisplayed() && !aRes->isConcealed()) {
+        // Hide the presentation with an empty shape. But isDisplayed state of the object should not
+        // be changed to the object becomes visible when the shape becomes not empty
+        if (!aRes->shape().get() || aRes->shape()->isNull())
+          continue;
+        ResultBodyPtr aResBody = std::dynamic_pointer_cast<ModelAPI_ResultBody>(aRes);
+        if (aResBody.get())
+          synchronizeResultTree(aResBody, false);
+        else {
+          if (aRes->isInHistory()) {
+            if (aRes->isDisplayed())
+              myDisplayer->display(aRes, false);
+            else
+              myDisplayer->erase(aRes, false);
+          }
+          else
+            aRes->setDisplayed(false);
+        }
+      }
     }
   }
   if (theUpdateViewer)
     myDisplayer->updateViewer();
 }
+
+void XGUI_Workshop::synchronizeResultTree(const ResultBodyPtr& theRes, bool theUpdateViewer)
+{
+  if (theRes->numberOfSubs() > 0)
+    for (int i = 0; i < theRes->numberOfSubs(); i++) {
+      ResultBodyPtr aRes = theRes->subResult(i);
+      if (aRes.get())
+        synchronizeResultTree(aRes, theUpdateViewer);
+    }
+  else {
+    if (theRes->isDisplayed())
+      myDisplayer->display(theRes, theUpdateViewer);
+    else
+      myDisplayer->erase(theRes, theUpdateViewer);
+  }
+}
 #endif
 
 //******************************************************
@@ -2710,9 +2923,7 @@ void XGUI_Workshop::highlightResults(const QObjectPtrList& theObjects)
   }
   if (aSelList.count() > theObjects.count()) {
     // if something was found
-    bool aBlocked = objectBrowser()->blockSignals(true);
     objectBrowser()->setObjectsSelected(aSelList);
-    objectBrowser()->blockSignals(aBlocked);
     objectBrowser()->ensureVisible(aNewSel.first());
   }
   if (aHasHidden)
@@ -2739,9 +2950,7 @@ void XGUI_Workshop::highlightFeature(const QObjectPtrList& theObjects)
   }
   if (aSelList.count() > theObjects.count()) {
     // if something was found
-    bool aBlocked = objectBrowser()->blockSignals(true);
     objectBrowser()->setObjectsSelected(aSelList);
-    objectBrowser()->blockSignals(aBlocked);
     objectBrowser()->ensureVisible(aNewSel.first());
   }
 }
@@ -2831,16 +3040,16 @@ void XGUI_Workshop::updateAutoComputeState()
   SessionPtr aMgr = ModelAPI_Session::get();
   bool isComputeBlocked = aMgr->isAutoUpdateBlocked();
 #ifdef HAVE_SALOME
-  QAction* aUpdateCmd;
-  QList<QAction*> aCommands = mySalomeConnector->commandList();
-  foreach(QAction* aCmd, aCommands) {
-    if (aCmd->data().toString() == "AUTOCOMPUTE_CMD") {
-      aUpdateCmd = aCmd;
-      break;
-    }
-  }
-  aUpdateCmd->setIcon(isComputeBlocked? QIcon(":pictures/autoapply_stop.png") :
-    QIcon(":pictures/autoapply_start.png"));
+//  QAction* aUpdateCmd;
+//  QList<QAction*> aCommands = mySalomeConnector->commandList();
+//  foreach(QAction* aCmd, aCommands) {
+//    if (aCmd->data().toString() == "AUTOCOMPUTE_CMD") {
+//      aUpdateCmd = aCmd;
+//      break;
+//    }
+//  }
+//  aUpdateCmd->setIcon(isComputeBlocked? QIcon(":pictures/autoapply_stop.png") :
+//    QIcon(":pictures/autoapply_start.png"));
 #else
   AppElements_MainMenu* aMenuBar = myMainWindow->menuObject();
   AppElements_Command* aUpdateCmd = aMenuBar->feature("AUTOCOMPUTE_CMD");
@@ -2860,4 +3069,24 @@ void XGUI_Workshop::clearTemporaryDir()
       aDir.remove(aFile);
     }
   }
-}
\ No newline at end of file
+}
+
+
+void XGUI_Workshop::onDockSizeChanged()
+{
+  QDockWidget* aDockWgt = dynamic_cast<QDockWidget*>(myObjectBrowser->parentWidget());
+  int aObWidth = aDockWgt->size().width();
+  if (myPropertyPanel->width() != aObWidth) {
+    QList<QDockWidget*> aWgtList;
+    aWgtList << myPropertyPanel << aDockWgt;
+    QList<int> aSizeList;
+    aSizeList << aObWidth << aObWidth;
+    desktop()->resizeDocks(aWgtList, aSizeList, Qt::Horizontal);
+    disconnect(myObjectBrowser, SIGNAL(sizeChanged()), this, SLOT(onDockSizeChanged()));
+  }
+}
+
+void XGUI_Workshop::deactivateCurrentSelector()
+{
+  myActiveControlMgr->deactivateSelector(myActiveControlMgr->activeSelector());
+}