Salome HOME
Bodies folder in Part data tree
[modules/shaper.git] / src / XGUI / XGUI_ViewerProxy.cpp
index b39b1ce97946f3193ded0fde8140549a393ee512..19453efdb3a4719691ba02a5952c86c9a4cf14fe 100644 (file)
@@ -51,6 +51,16 @@ void XGUI_ViewerProxy::setViewProjection(double theX, double theY, double theZ)
   }
 }
 
+void XGUI_ViewerProxy::fitAll()
+{
+  if (myWorkshop->isSalomeMode()) {
+    myWorkshop->salomeConnector()->viewer()->fitAll();
+  }
+  else {
+    XGUI_Viewer* aViewer = myWorkshop->mainWindow()->viewer();
+    aViewer->activeViewWindow()->viewPort()->fitAll();
+  }
+}
 
 void XGUI_ViewerProxy::connectToViewer()
 {
@@ -85,6 +95,11 @@ void XGUI_ViewerProxy::connectToViewer()
     
     connect(aViewer, SIGNAL(keyRelease(QKeyEvent*)),
             this, SIGNAL(keyRelease(QKeyEvent*)));
+
+    connect(aViewer, SIGNAL(selectionChanged()), this, SIGNAL(selectionChanged()));
+    connect(aViewer, SIGNAL(contextMenuRequested(QContextMenuEvent*)), 
+            this, SIGNAL(contextMenuRequested(QContextMenuEvent*)));
+
   } else {
     XGUI_Viewer* aViewer = myWorkshop->mainWindow()->viewer();
 
@@ -111,6 +126,10 @@ void XGUI_ViewerProxy::connectToViewer()
             this, SLOT(onKeyPress(XGUI_ViewWindow*, QKeyEvent*)));
     connect(aViewer, SIGNAL(keyRelease(XGUI_ViewWindow*, QKeyEvent*)),
             this, SLOT(onKeyRelease(XGUI_ViewWindow*, QKeyEvent*)));
+
+    connect(aViewer, SIGNAL(selectionChanged()), this, SIGNAL(selectionChanged()));
+    connect(aViewer, SIGNAL(contextMenuRequested(QContextMenuEvent*)), 
+            this, SIGNAL(contextMenuRequested(QContextMenuEvent*)));
   }
 }
 
@@ -143,3 +162,43 @@ void XGUI_ViewerProxy::onKeyRelease(XGUI_ViewWindow*, QKeyEvent* theEvent)
 {
   emit keyRelease(theEvent);
 }
+
+//***************************************
+void XGUI_ViewerProxy::enableSelection(bool isEnabled)
+{
+  if (myWorkshop->isSalomeMode()) {
+    myWorkshop->salomeConnector()->viewer()->enableSelection(isEnabled);
+  } else {
+    myWorkshop->mainWindow()->viewer()->setSelectionEnabled(isEnabled);
+  }
+}
+
+//***************************************
+bool XGUI_ViewerProxy::isSelectionEnabled() const
+{
+  if (myWorkshop->isSalomeMode()) {
+    return myWorkshop->salomeConnector()->viewer()->isSelectionEnabled();
+  } else {
+    return myWorkshop->mainWindow()->viewer()->isSelectionEnabled();
+  }
+}
+
+//***************************************
+void XGUI_ViewerProxy::enableMultiselection(bool isEnable)
+{
+  if (myWorkshop->isSalomeMode()) {
+    myWorkshop->salomeConnector()->viewer()->enableMultiselection(isEnable);
+  } else {
+    myWorkshop->mainWindow()->viewer()->setMultiSelectionEnabled(isEnable);
+  }
+}
+
+//***************************************
+bool XGUI_ViewerProxy::isMultiSelectionEnabled() const
+{
+  if (myWorkshop->isSalomeMode()) {
+    return myWorkshop->salomeConnector()->viewer()->isMultiSelectionEnabled();
+  } else {
+    return myWorkshop->mainWindow()->viewer()->isMultiSelectionEnabled();
+  }
+}