From: asv Date: Mon, 11 Jul 2005 11:07:49 +0000 (+0000) Subject: Popup-s changed. "isActiveViewer" parameter = "isActiveView", its calculation is... X-Git-Tag: V3_0_1~7 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=2cff49a1b0198bd22faaeb615692bfc98c20b95d;p=modules%2Fgeom.git Popup-s changed. "isActiveViewer" parameter = "isActiveView", its calculation is moved to SalomeApp level. --- diff --git a/src/GEOMGUI/GEOMGUI_Selection.cxx b/src/GEOMGUI/GEOMGUI_Selection.cxx index 897b85bb5..1d1111eee 100644 --- a/src/GEOMGUI/GEOMGUI_Selection.cxx +++ b/src/GEOMGUI/GEOMGUI_Selection.cxx @@ -40,9 +40,8 @@ GEOMGUI_Selection::~GEOMGUI_Selection() QtxValue GEOMGUI_Selection::globalParam( const QString& p ) const { - if ( p == "isOCC" ) return QtxValue( isOCC() ); - else if ( p == "isActiveViewer" ) return QtxValue( isActiveViewer() ); - + if ( p == "isOCC" ) return QtxValue( activeViewType() == OCCViewer_Viewer::Type() ); + return SalomeApp_Selection::globalParam( p ); } @@ -81,18 +80,14 @@ bool GEOMGUI_Selection::isVisible( const int index ) const return false; } -bool GEOMGUI_Selection::isOCC() const -{ - return activeViewType( OCCViewer_Viewer::Type() ); -} - QString GEOMGUI_Selection::displayMode( const int index ) const { SALOME_View* view = GEOM_Displayer::GetActiveView(); - if ( view /*fix for 9320==>*/&& ( isOCC() || activeViewType( VTKViewer_Viewer::Type() ) ) ) { + QString viewType = activeViewType(); + if ( view /*fix for 9320==>*/&& ( viewType == OCCViewer_Viewer::Type() || viewType == VTKViewer_Viewer::Type() ) ) { SALOME_Prs* prs = view->CreatePrs( entry( index ) ); if ( prs ) { - if ( isOCC() ) { // assuming OCC + if ( viewType == OCCViewer_Viewer::Type() ) { // assuming OCC SOCC_Prs* occPrs = (SOCC_Prs*) prs; AIS_ListOfInteractive lst; occPrs->GetObjects( lst ); @@ -117,7 +112,7 @@ QString GEOMGUI_Selection::displayMode( const int index ) const } } } - else if ( activeViewType( VTKViewer_Viewer::Type() ) ) { // assuming VTK + else if ( viewType == VTKViewer_Viewer::Type() ) { // assuming VTK SVTK_Prs* vtkPrs = (SVTK_Prs*) prs; vtkActorCollection* lst = vtkPrs->GetObjects(); if ( lst ) { @@ -178,31 +173,3 @@ 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 ( 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; -} diff --git a/src/GEOMGUI/GEOMGUI_Selection.h b/src/GEOMGUI/GEOMGUI_Selection.h index 01648e32a..0a6f9f217 100644 --- a/src/GEOMGUI/GEOMGUI_Selection.h +++ b/src/GEOMGUI/GEOMGUI_Selection.h @@ -45,14 +45,11 @@ public: private: bool isVisible( const int ) const; - bool isOCC() const; - bool isActiveViewer() const; QString typeName( const int ) const; QString displayMode( const int ) const; bool isComponent( const int ) const; GEOM::GEOM_Object_ptr getObject( const int ) const; - bool activeViewType( const QString& ) const; }; #endif diff --git a/src/GEOMGUI/GeometryGUI.cxx b/src/GEOMGUI/GeometryGUI.cxx index c7f9dc355..e75c987f9 100644 --- a/src/GEOMGUI/GeometryGUI.cxx +++ b/src/GEOMGUI/GeometryGUI.cxx @@ -966,13 +966,13 @@ void GeometryGUI::initialize( CAM_Application* app ) mgr->setRule( action( 8034 ), "client='OCCViewer' and selcount>0", true ); mgr->insert( separator(), -1, -1 ); // ----------- mgr->insert( action( 216 ), -1, -1 ); // display - mgr->setRule( action( 216 ), "isActiveViewer=true and selcount>0 and (($type in {'Shape' 'Group'} and isVisible=false) or type='Component')", true ); + mgr->setRule( action( 216 ), "isActiveView=true and selcount>0 and (($type in {'Shape' 'Group'} and isVisible=false) or type='Component')", true ); mgr->insert( action( 215 ), -1, -1 ); // erase - mgr->setRule( action( 215 ), "isActiveViewer=true and selcount>0 and (($type in {'Shape' 'Group'} and isVisible=true) or (type='Component' and selcount=1))", true ); + mgr->setRule( action( 215 ), "isActiveView=true and selcount>0 and (($type in {'Shape' 'Group'} and isVisible=true) or (type='Component' and selcount=1))", true ); mgr->insert( action( 214 ), -1, -1 ); // erase All mgr->setRule( action( 214 ), "client='OCCViewer' or client='VTKViewer'", true ); mgr->insert( action( 213 ), -1, -1 ); // display only - mgr->setRule( action( 213 ), "isActiveViewer=true and selcount>0 and ($type in {'Shape' 'Group'} or (type='Component' and selcount=1))", true ); + mgr->setRule( action( 213 ), "isActiveView=true and selcount>0 and ($type in {'Shape' 'Group'} or (type='Component' and selcount=1))", true ); mgr->insert( separator(), -1, -1 ); }