Salome HOME
Merge branch 'master' of newgeom:newgeom
[modules/shaper.git] / src / XGUI / XGUI_Workshop.cpp
index 25866c87cd26bb6216df220c51dbd62c819548de..1b48c4e081c1d7fc1f2c17e73c3f2782cfd49d62 100644 (file)
@@ -495,6 +495,7 @@ void XGUI_Workshop::onOperationStarted()
     for (; anIt != aLast; anIt++) {
       aWidget = *anIt;
       aWidget->setFeature(aOperation->feature());
+      aWidget->enableFocusProcessing();
       QObject::connect(aWidget, SIGNAL(valuesChanged()), this, SLOT(onWidgetValuesChanged()));
       // Init default values
       if (!aOperation->isEditOperation() && !aWidget->isComputedDefault()) {
@@ -504,7 +505,11 @@ void XGUI_Workshop::onOperationStarted()
 
     myPropertyPanel->setModelWidgets(aWidgets);
     myPropertyPanel->onActivateNextWidget(NULL);
-    myPropertyPanel->setWindowTitle(aOperation->getDescription()->description());
+    // Widget activation (from the previous method) may commit the current operation
+    // if pre-selection is enougth for it. So we shouldn't update prop panel's title
+    if(myOperationMgr->isCurrentOperation(aOperation)) {
+      myPropertyPanel->setWindowTitle(aOperation->getDescription()->description());
+    }
   }
   updateCommandStatus();
 }
@@ -522,12 +527,6 @@ bool XGUI_Workshop::event(QEvent * theEvent)
 {
   PostponeMessageQtEvent* aPostponedEv = dynamic_cast<PostponeMessageQtEvent*>(theEvent);
   if (aPostponedEv) {
-#ifdef _DEBUG
-    std::cout << "XGUI_Workshop::event " << "Got PostponeMessageQtEvent" << std::endl;
-    bool isMyThread = (QApplication::instance()->thread() == QThread::currentThread());
-    std::cout << "XGUI_Workshop::event " << "I am in the Qt's thread: "
-              << isMyThread << std::endl;
-#endif
     boost::shared_ptr<Events_Message> aEventPtr = aPostponedEv->postponedMessage();
     processEvent(aEventPtr);
     return true;
@@ -789,9 +788,17 @@ void XGUI_Workshop::onRedo()
 //******************************************************
 void XGUI_Workshop::onRebuild()
 {
+  SessionPtr aMgr = ModelAPI_Session::get();
+  bool aWasOperation = aMgr->isOperation(); // keep this value
+  if (!aWasOperation) {
+    aMgr->startOperation();
+  }
   static const Events_ID aRebuildEvent = Events_Loop::loop()->eventByName("Rebuild");
   Events_Loop::loop()->send(boost::shared_ptr<Events_Message>(
     new Events_Message(aRebuildEvent, this)));
+  if (!aWasOperation) {
+    aMgr->finishOperation();
+  }
 }
 
 //******************************************************
@@ -866,7 +873,7 @@ ModuleBase_IModule* XGUI_Workshop::loadModule(const QString& theModule)
 
   if (!err.isEmpty()) {
     if (mainWindow()) {
-      QMessageBox::warning(mainWindow(), tr("Error"), err);
+      Events_Error::send(err.toStdString());
     } else {
       qWarning(qPrintable(err));
     }
@@ -1085,6 +1092,8 @@ void XGUI_Workshop::onContextMenuCommand(const QString& theId, bool isChecked)
     setDisplayMode(aObjects, XGUI_Displayer::Shading);
   else if (theId == "WIREFRAME_CMD")
     setDisplayMode(aObjects, XGUI_Displayer::Wireframe);
+  else if (theId == "HIDEALL_CMD")
+    myDisplayer->eraseAll();
 }
 
 //**************************************************************