Popup-s changed. "isActiveViewer" parameter = "isActiveView", its calculation is moved to SalomeApp level.

This commit is contained in:
asv 2005-07-11 11:07:49 +00:00
parent 144524d7be
commit 2cff49a1b0
3 changed files with 9 additions and 45 deletions

View File

@ -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;
}

View File

@ -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

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