]> SALOME platform Git repositories - modules/shaper.git/blobdiff - src/XGUI/XGUI_Workshop.cpp
Salome HOME
Merge branch 'master' of newgeom:newgeom.git
[modules/shaper.git] / src / XGUI / XGUI_Workshop.cpp
index dd6e1200fc321ab3db8b5f3fd42f04f45d916ab4..e36e3c26998e037642480ed913fb20c29556a4b4 100644 (file)
@@ -63,6 +63,7 @@ XGUI_Workshop::XGUI_Workshop(XGUI_SalomeConnector* theConnector)
   // So, displayer will be created on demand.
 
   mySelector = new XGUI_SelectionMgr(this);
+  connect(mySelector, SIGNAL(selectionChanged()), this, SLOT(changeCurrentDocument()));
   myOperationMgr = new XGUI_OperationMgr(this);
   myActionsMgr = new XGUI_ActionsMgr(this);
   myErrorDlg = new XGUI_ErrorDialog(myMainWindow);
@@ -355,7 +356,7 @@ void XGUI_Workshop::onNew()
   QApplication::setOverrideCursor(Qt::WaitCursor);
   if (objectBrowser() == 0) {
     createDockWidgets();
-    mySelector->connectObjectBrowser(objectBrowser());
+    mySelector->connectViewers();
   }
   showObjectBrowser();
   if (!isSalomeMode()) {
@@ -690,3 +691,25 @@ XGUI_Displayer* XGUI_Workshop::displayer() const
   }
   return myDisplayer;
 }
+
+//******************************************************
+void XGUI_Workshop::changeCurrentDocument()
+{
+  QFeatureList aFeatures = objectBrowser()->selectedFeatures();
+  
+  // Set current document
+  if (aFeatures.size() > 0) {
+    FeaturePtr aFeature = aFeatures.first();
+
+    boost::shared_ptr<ModelAPI_PluginManager> aMgr = ModelAPI_PluginManager::get();
+    boost::shared_ptr<ModelAPI_AttributeDocRef> aDocRef = aFeature->data()->docRef("PartDocument");
+    if (aDocRef)
+      aMgr->setCurrentDocument(aDocRef->value());
+  }
+}
+
+//******************************************************
+void XGUI_Workshop::salomeViewerSelectionChanged()
+{
+  emit salomeViewerSelection();
+}