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 );
}
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 );
}
}
}
- 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 ) {
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;
-}
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
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 );
}