Salome HOME
refs #30 - Sketch base GUI: create, draw lines
[modules/shaper.git] / src / XGUI / XGUI_SelectionMgr.cpp
index efca3fde5a3ff658a2736867af5e2393a9819d18..f949c782a5a4b4a7ca17f5440ef2a7513a1cc441 100644 (file)
@@ -4,6 +4,7 @@
 #include "XGUI_ObjectsBrowser.h"
 #include "XGUI_Viewer.h"
 #include "XGUI_SalomeConnector.h"
+#include "XGUI_ViewerProxy.h"
 
 #include <ModelAPI_Feature.h>
 #include <ModelAPI_PluginManager.h>
@@ -49,6 +50,7 @@ void XGUI_SelectionMgr::onObjectBrowserSelection()
 //**************************************************************
 void XGUI_SelectionMgr::onViewerSelection()
 {
+  // TODO: Highliht selected objects in Object Browser
   emit selectionChanged();
 }
 
@@ -61,36 +63,26 @@ QFeatureList XGUI_SelectionMgr::selectedFeatures() const
 //**************************************************************
 QModelIndexList XGUI_SelectionMgr::selectedIndexes() const 
 { 
-  return myWorkshop->objectBrowser()->selectionModel()->selectedIndexes();
+  return myWorkshop->objectBrowser()->selectedIndexes();
 }
 
 //**************************************************************
 void XGUI_SelectionMgr::selectedAISObjects(AIS_ListOfInteractive& theList) const
 {
-  if (myWorkshop->isSalomeMode()) {
-    Handle(AIS_InteractiveContext) aContext = myWorkshop->salomeConnector()->AISContext();
-    theList.Clear();
-    for (aContext->InitSelected(); aContext->MoreSelected(); aContext->NextSelected())
-      theList.Append(aContext->SelectedInteractive());
-  } else {
-    XGUI_Viewer* aViewer = myWorkshop->mainWindow()->viewer();
-    aViewer->getSelectedObjects(theList);
-  }
+  Handle(AIS_InteractiveContext) aContext = myWorkshop->viewer()->AISContext();
+  theList.Clear();
+  for (aContext->InitSelected(); aContext->MoreSelected(); aContext->NextSelected())
+    theList.Append(aContext->SelectedInteractive());
 }
 
 //**************************************************************
 void XGUI_SelectionMgr::selectedShapes(NCollection_List<TopoDS_Shape>& theList) const
 {
-  if (myWorkshop->isSalomeMode()) {
-    theList.Clear();
-    Handle(AIS_InteractiveContext) aContext = myWorkshop->salomeConnector()->AISContext();
-    for (aContext->InitSelected(); aContext->MoreSelected(); aContext->NextSelected()) {
-      TopoDS_Shape aShape = aContext->SelectedShape();
-      if (!aShape.IsNull())
-        theList.Append(aShape);
-    }
-  } else {
-    XGUI_Viewer* aViewer = myWorkshop->mainWindow()->viewer();
-    aViewer->getSelectedShapes(theList);
+  theList.Clear();
+  Handle(AIS_InteractiveContext) aContext = myWorkshop->viewer()->AISContext();
+  for (aContext->InitSelected(); aContext->MoreSelected(); aContext->NextSelected()) {
+    TopoDS_Shape aShape = aContext->SelectedShape();
+    if (!aShape.IsNull())
+      theList.Append(aShape);
   }
-}
\ No newline at end of file
+}