Salome HOME
Merge branch 'Dev_0.7.1' of newgeom:newgeom into Dev_0.7.1
[modules/shaper.git] / src / XGUI / XGUI_Workshop.cpp
index 3900f6606298deaebac62257973a08d909367c77..4022d7fc70d4e4cb0750393b73cddf4e75dbbad9 100644 (file)
@@ -206,6 +206,8 @@ void XGUI_Workshop::startApplication()
   }
   
   onNew();
+
+  emit applicationStarted();
 }
 
 //******************************************************
@@ -478,6 +480,7 @@ void XGUI_Workshop::onFeatureRedisplayMsg(const std::shared_ptr<ModelAPI_ObjectU
   std::set<ObjectPtr>::const_iterator aIt;
   for (aIt = aObjects.begin(); aIt != aObjects.end(); ++aIt) {
     ObjectPtr aObj = (*aIt);
+
     bool aHide = !aObj->data() || !aObj->data()->isValid();
     if (!aHide) { // check that this is not hidden result
       ResultPtr aRes = std::dynamic_pointer_cast<ModelAPI_Result>(aObj);
@@ -497,8 +500,7 @@ void XGUI_Workshop::onFeatureRedisplayMsg(const std::shared_ptr<ModelAPI_ObjectU
       } else {
         if (myOperationMgr->hasOperation()) {
           ModuleBase_Operation* aOperation = myOperationMgr->currentOperation();
-          // Display only current operation results if operation has preview
-          if (aOperation->hasObject(aObj)/* && aOperation->hasPreview()*/) {
+          if (myModule->canDisplayObject(aObj)) {
             displayObject(aObj);
             // Deactivate object of current operation from selection
             if (myDisplayer->isActive(aObj))
@@ -520,17 +522,15 @@ void XGUI_Workshop::onFeatureCreatedMsg(const std::shared_ptr<ModelAPI_ObjectUpd
   bool aHasPart = false;
   bool isDisplayed = false;
   for (aIt = aObjects.begin(); aIt != aObjects.end(); ++aIt) {
+
     ResultPartPtr aPart = std::dynamic_pointer_cast<ModelAPI_ResultPart>(*aIt);
     if (aPart) {
       aHasPart = true;
       // If a feature is created from the aplication's python console  
       // it doesn't stored in the operation mgr and doesn't displayed
-    } else if (myOperationMgr->hasOperation()) {
-      ModuleBase_Operation* aOperation = myOperationMgr->currentOperation();
-      if (aOperation->hasObject(*aIt)) {  // Display only current operation results
-        displayObject(*aIt);
-        isDisplayed = true;
-      }
+    } else if (myModule->canDisplayObject(*aIt)) {
+      displayObject(*aIt);
+      isDisplayed = true;
     }
   }
   if (myObjectBrowser)
@@ -632,7 +632,7 @@ void XGUI_Workshop::setPropertyPanel(ModuleBase_Operation* theOperation)
     aWidget->enableFocusProcessing();
     QObject::connect(aWidget, SIGNAL(valuesChanged()), this, SLOT(onWidgetValuesChanged()));
     // Init default values
-    if (!theOperation->isEditOperation() && !aWidget->isComputedDefault()) {
+    if (!theOperation->isEditOperation() && aWidget->isValueDefault() && !aWidget->isComputedDefault()) {
       aWidget->storeValue();
     }
   }
@@ -1093,7 +1093,7 @@ void XGUI_Workshop::createDockWidgets()
   connect(myPropertyPanel, SIGNAL(noMoreWidgets()), myModule, SLOT(onNoMoreWidgets()));
 
   aDesktop->addDockWidget(Qt::LeftDockWidgetArea, myPropertyPanel);
-  hidePropertyPanel();  //<! Invisible by default
+  hidePropertyPanel();  ///<! Invisible by default
   hideObjectBrowser();
   aDesktop->tabifyDockWidget(aObjDock, myPropertyPanel);
   myPropertyPanel->installEventFilter(myOperationMgr);
@@ -1104,7 +1104,7 @@ void XGUI_Workshop::createDockWidgets()
   connect(aCancelBtn, SIGNAL(clicked()), myOperationMgr, SLOT(onAbortOperation()));
   connect(myPropertyPanel, SIGNAL(keyReleased(QKeyEvent*)), myOperationMgr,
           SLOT(onKeyReleased(QKeyEvent*)));
-  connect(myOperationMgr, SIGNAL(operationValidated(bool)), myPropertyPanel,
+  connect(myOperationMgr, SIGNAL(applyEnableChanged(bool)), myPropertyPanel,
           SLOT(setAcceptEnabled(bool)));
 
 }
@@ -1113,7 +1113,7 @@ void XGUI_Workshop::createDockWidgets()
 void XGUI_Workshop::showPropertyPanel()
 {
   QAction* aViewAct = myPropertyPanel->toggleViewAction();
-  //<! Restore ability to close panel from the window's menu
+  ///<! Restore ability to close panel from the window's menu
   aViewAct->setEnabled(true);
   myPropertyPanel->show();
   myPropertyPanel->raise();
@@ -1123,7 +1123,7 @@ void XGUI_Workshop::showPropertyPanel()
 void XGUI_Workshop::hidePropertyPanel()
 {
   QAction* aViewAct = myPropertyPanel->toggleViewAction();
-  //<! Do not allow to show empty property panel
+  ///<! Do not allow to show empty property panel
   aViewAct->setEnabled(false);
   myPropertyPanel->hide();
 }
@@ -1239,20 +1239,21 @@ void XGUI_Workshop::activatePart(ResultPartPtr theFeature)
     myObjectBrowser->activatePart(theFeature);
     myPartActivating = false;
   }
+  updateCommandStatus();
 }
 
 //**************************************************************
-void XGUI_Workshop::activateLastPart()
-{
-  SessionPtr aMgr = ModelAPI_Session::get();
-  DocumentPtr aDoc = aMgr->moduleDocument();
-  std::string aGrpName = ModelAPI_ResultPart::group();
-  ObjectPtr aLastPart = aDoc->object(aGrpName, aDoc->size(aGrpName) - 1);
-  ResultPartPtr aPart = std::dynamic_pointer_cast<ModelAPI_ResultPart>(aLastPart);
-  if (aPart) {
-    activatePart(aPart);
-  }
-}
+//void XGUI_Workshop::activateLastPart()
+//{
+//  SessionPtr aMgr = ModelAPI_Session::get();
+//  DocumentPtr aDoc = aMgr->moduleDocument();
+//  std::string aGrpName = ModelAPI_ResultPart::group();
+//  ObjectPtr aLastPart = aDoc->object(aGrpName, aDoc->size(aGrpName) - 1);
+//  ResultPartPtr aPart = std::dynamic_pointer_cast<ModelAPI_ResultPart>(aLastPart);
+//  if (aPart) {
+//    activatePart(aPart);
+//  }
+//}
 
 //**************************************************************
 void XGUI_Workshop::deleteObjects(const QObjectPtrList& theList)