bug fixes with popup menus.

This commit is contained in:
asv 2005-06-14 12:40:36 +00:00
parent 8ace3710d8
commit 5013150a88
3 changed files with 36 additions and 11 deletions

View File

@ -19,6 +19,9 @@
#include <SALOME_InteractiveObject.hxx>
#include <SOCC_Prs.h>
#include <SVTK_Prs.h>
#include <SALOME_Actor.h>
#include <vtkActorCollection.h>
#include <OCCViewer_ViewModel.h>
@ -42,9 +45,10 @@ QtxValue GEOMGUI_Selection::param( const int ind, const QString& p ) const
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() );
}
//printf( "--> param() : [%s] = %s\n", p.latin1(), val.toString ().latin1() );
printf( "--> param() : [%s] = %s\n", p.latin1(), val.toString ().latin1() );
return val;
}
@ -113,8 +117,23 @@ QString GEOMGUI_Selection::displayMode( const int index ) const
}
}
else { // assuming VTK
}
SVTK_Prs* vtkPrs = (SVTK_Prs*) prs;
vtkActorCollection* lst = vtkPrs->GetObjects();
if ( lst ) {
lst->InitTraversal();
vtkActor* actor = lst->GetNextActor();
if ( actor ) {
SALOME_Actor* salActor = dynamic_cast<SALOME_Actor*>( actor );
if ( salActor ) {
int dm = salActor->getDisplayMode();
if ( dm == 0 )
return "Wireframe";
else if ( dm == 1 )
return "Shading";
} // if ( salome actor )
} // if ( actor )
} // if ( lst == vtkPrs->GetObjects() )
} // if VTK
}
}
return "";
@ -157,3 +176,8 @@ GEOM::GEOM_Object_ptr GEOMGUI_Selection::getObject( const int index ) const
}
return GEOM::GEOM_Object::_nil();
}
bool GEOMGUI_Selection::isActiveViewer() const
{
return ( SUIT_Session::session()->activeApplication()->desktop()->activeWindow() != 0 );
}

View File

@ -45,6 +45,7 @@ public:
private:
bool isVisible( const int ) const;
bool isOCC() const;
bool isActiveViewer() const;
QString typeName( const int ) const;
QString displayMode( const int ) const;

View File

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