X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FGEOMGUI%2FGEOMGUI_Selection.cxx;h=897b85bb55644526e764167c1e4d6f4faa5971b2;hb=144524d7be0c8389b25a57b7fcf831f0724e9e22;hp=c7ff2558fe8a53152c9533e9f510e0c769edb9b9;hpb=14c6b1f558173860eb0d3bd0dcd2084e665988f2;p=modules%2Fgeom.git diff --git a/src/GEOMGUI/GEOMGUI_Selection.cxx b/src/GEOMGUI/GEOMGUI_Selection.cxx index c7ff2558f..897b85bb5 100644 --- a/src/GEOMGUI/GEOMGUI_Selection.cxx +++ b/src/GEOMGUI/GEOMGUI_Selection.cxx @@ -24,6 +24,7 @@ #include #include +#include #include #include @@ -82,14 +83,13 @@ bool GEOMGUI_Selection::isVisible( const int index ) const bool GEOMGUI_Selection::isOCC() const { - SUIT_ViewWindow* window = SUIT_Session::session()->activeApplication()->desktop()->activeWindow(); - return ( window && window->getViewManager()->getType() == OCCViewer_Viewer::Type() ); + return activeViewType( OCCViewer_Viewer::Type() ); } QString GEOMGUI_Selection::displayMode( const int index ) const { SALOME_View* view = GEOM_Displayer::GetActiveView(); - if ( view ) { + if ( view /*fix for 9320==>*/&& ( isOCC() || activeViewType( VTKViewer_Viewer::Type() ) ) ) { SALOME_Prs* prs = view->CreatePrs( entry( index ) ); if ( prs ) { if ( isOCC() ) { // assuming OCC @@ -117,7 +117,7 @@ QString GEOMGUI_Selection::displayMode( const int index ) const } } } - else { // assuming VTK + else if ( activeViewType( VTKViewer_Viewer::Type() ) ) { // assuming VTK SVTK_Prs* vtkPrs = (SVTK_Prs*) prs; vtkActorCollection* lst = vtkPrs->GetObjects(); if ( lst ) { @@ -178,8 +178,31 @@ GEOM::GEOM_Object_ptr GEOMGUI_Selection::getObject( const int index ) const return GEOM::GEOM_Object::_nil(); } +SUIT_ViewWindow* activeVW() +{ + SUIT_Session* session = SUIT_Session::session(); + if ( session ) { + SUIT_Application* app = session->activeApplication(); + if ( app ) { + SUIT_Desktop* desk = app->desktop(); + if ( desk ) + return desk->activeWindow(); + } + } + return 0; +} + bool GEOMGUI_Selection::isActiveViewer() const { - return ( SUIT_Session::session()->activeApplication()->desktop()->activeWindow() != 0 ); + return ( activeVW() != 0 ); } +bool GEOMGUI_Selection::activeViewType( const QString& type ) const +{ + SUIT_ViewWindow* win = activeVW(); + if ( win ) { + SUIT_ViewManager* vm = win->getViewManager(); + return ( vm && vm->getType() == type ); + } + return false; +}