+//**************************************************************
+void XGUI_SelectionMgr::connectViewers()
+{
+ connect(myWorkshop->objectBrowser(), SIGNAL(selectionChanged()), this,
+ SLOT(onObjectBrowserSelection()));
+
+ //Connect to other viewers
+ connect(myWorkshop->viewer(), SIGNAL(selectionChanged()), this, SLOT(onViewerSelection()));
+}
+
+//**************************************************************
+void XGUI_SelectionMgr::setSelectedOwners(const SelectMgr_IndexedMapOfOwner& theSelectedOwners,
+ bool isUpdateViewer)
+{
+ Handle(AIS_InteractiveContext) aContext = myWorkshop->viewer()->AISContext();
+ if (!aContext.IsNull()) {
+ /// previous selection should be cleared, else there will be decomposition of selections:
+ /// as AddOrRemoveSelected inverts current selection
+ aContext->ClearSelected(false);
+
+ for (Standard_Integer i = 1, n = theSelectedOwners.Extent(); i <= n; i++) {
+ Handle(SelectMgr_EntityOwner) anOwner = theSelectedOwners(i);
+
+ aContext->AddOrRemoveSelected(anOwner, isUpdateViewer);
+ #ifdef VINSPECTOR
+ if (myWorkshop->displayer()->getCallBack())
+ myWorkshop->displayer()->getCallBack()->AddOrRemoveSelected(anOwner);
+ #endif
+ }
+ }
+}
+
+//**************************************************************
+void XGUI_SelectionMgr::onObjectBrowserSelection()