X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FSession%2FSession_Session_i.cxx;h=95103de9ce9e2bdd5ac6421b9e2917bbeea932c7;hb=da0829dff07ea351cd385c493e2f63bf15640234;hp=c5bb83a04fe7f5617f2351a5c5b028084f468cdc;hpb=6878ef4d7381638ec39d1ca9d03afc21a69401aa;p=modules%2Fgui.git diff --git a/src/Session/Session_Session_i.cxx b/src/Session/Session_Session_i.cxx index c5bb83a04..95103de9c 100755 --- a/src/Session/Session_Session_i.cxx +++ b/src/Session/Session_Session_i.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2016 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -30,6 +30,9 @@ #include "SALOME_NamingService.hxx" #include "SALOME_Event.h" #include "SalomeApp_Engine_i.h" +#include "LightApp_Application.h" +#include "LightApp_SelectionMgr.h" +#include "SALOME_ListIO.hxx" #include "SUIT_Session.h" #include "SUIT_Desktop.h" #include "SUIT_Study.h" @@ -61,7 +64,7 @@ SALOME_Session_i::SALOME_Session_i(int argc, { _argc = argc ; _argv = argv ; - _isGUI = FALSE ; + _isGUI = false ; _runningStudies= 0 ; _orb = CORBA::ORB::_duplicate(orb) ; _poa = PortableServer::POA::_duplicate(poa) ; @@ -326,3 +329,27 @@ void SALOME_Session_i::emitMessageOneWay(const char* theMessage) { emitMessage(theMessage); } + +SALOME::StringSeq* SALOME_Session_i::getSelection() +{ + SALOME::StringSeq_var selection = new SALOME::StringSeq; + _GUIMutex->lock(); + if ( SUIT_Session::session() ) { + LightApp_Application* app = dynamic_cast( SUIT_Session::session()->activeApplication() ); + if ( app ) { + LightApp_SelectionMgr* selMgr = dynamic_cast( app->selectionMgr() ); + SALOME_ListIO selected; + selMgr->selectedObjects( selected ); + selection->length( selected.Extent() ); + int nbSel = 0; + for ( SALOME_ListIteratorOfListIO it( selected ); it.More(); it.Next() ) { + Handle( SALOME_InteractiveObject ) io = it.Value(); + if ( io->hasEntry() ) + selection[nbSel++] = CORBA::string_dup( io->getEntry() ); + } + selection->length( nbSel ); + } + } + _GUIMutex->unlock(); + return selection._retn(); +}