new function globalParam() of Selection is used in GEOM.

This commit is contained in:
asv 2005-06-24 06:13:27 +00:00
parent 167977175e
commit 14c6b1f558
3 changed files with 18 additions and 15 deletions

View File

@ -37,20 +37,21 @@ 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() );
return SalomeApp_Selection::globalParam( p );
}
QtxValue GEOMGUI_Selection::param( const int ind, const QString& p ) const
{
QtxValue val( SalomeApp_Selection::param( ind, p ) );
if ( !val.isValid() ) {
if ( p == "isVisible" ) val = QtxValue( isVisible( ind ) );
else if ( p == "isOCC" ) val = QtxValue( isOCC() );
else if ( p == "type" ) val = QtxValue( typeName( ind ) );
else if ( p == "displaymode" ) val = QtxValue( displayMode( ind ) );
else if ( p == "isActiveViewer" ) val = QtxValue( isActiveViewer() );
}
if ( p == "isVisible" ) return QtxValue( isVisible( ind ) );
else if ( p == "type" ) return QtxValue( typeName( ind ) );
else if ( p == "displaymode" ) return QtxValue( displayMode( ind ) );
//printf( "--> param() : [%s] = %s\n", p.latin1(), val.toString ().latin1() );
return val;
return SalomeApp_Selection::param( ind, p );
}
QString GEOMGUI_Selection::typeName( const int index ) const
@ -181,3 +182,4 @@ bool GEOMGUI_Selection::isActiveViewer() const
{
return ( SUIT_Session::session()->activeApplication()->desktop()->activeWindow() != 0 );
}

View File

@ -41,6 +41,7 @@ public:
virtual ~GEOMGUI_Selection();
virtual QtxValue param( const int, const QString& ) const;
virtual QtxValue globalParam( const QString& ) const;
private:
bool isVisible( const int ) const;

View File

@ -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 in {true} and selcount>0 and (($type in {'Shape' 'Group'} and ($isVisible in {false})) or $type in {'Component'})", true );
mgr->setRule( action( 216 ), "isActiveViewer=true and selcount>0 and (($type in {'Shape' 'Group'} and ($isVisible in {false})) or $type in {'Component'})", true );
mgr->insert( action( 215 ), -1, -1 ); // erase
mgr->setRule( action( 215 ), "$isActiveViewer in {true} and selcount>0 and (($type in {'Shape' 'Group'} and $isVisible in {true}) or ($type in {'Component'} and selcount=1))", true );
mgr->setRule( action( 215 ), "isActiveViewer=true and selcount>0 and (($type in {'Shape' 'Group'} and $isVisible in {true}) or ($type in {'Component'} and selcount=1))", true );
mgr->insert( action( 214 ), -1, -1 ); // erase All
mgr->setRule( action( 214 ), "$isActiveViewer in {true} and $client in {'OCCViewer' 'VTKViewer'}", true );
mgr->setRule( action( 214 ), "isActiveViewer=true and $client in {'OCCViewer' 'VTKViewer'}", true );
mgr->insert( action( 213 ), -1, -1 ); // display only
mgr->setRule( action( 213 ), "$isActiveViewer in {true} and selcount>0 and ($type in {'Shape' 'Group'} or ($type in {'Component'} and selcount=1))", true );
mgr->setRule( action( 213 ), "isActiveViewer=true and selcount>0 and ($type in {'Shape' 'Group'} or ($type in {'Component'} and selcount=1))", true );
mgr->insert( separator(), -1, -1 );
}