Salome HOME
Popup-s changed. "isActiveViewer" parameter = "isActiveView", its calculation is...
authorasv <asv@opencascade.com>
Mon, 11 Jul 2005 11:07:49 +0000 (11:07 +0000)
committerasv <asv@opencascade.com>
Mon, 11 Jul 2005 11:07:49 +0000 (11:07 +0000)
src/GEOMGUI/GEOMGUI_Selection.cxx
src/GEOMGUI/GEOMGUI_Selection.h
src/GEOMGUI/GeometryGUI.cxx

index 897b85bb55644526e764167c1e4d6f4faa5971b2..1d1111eeef7f33e41fe2e94e7d8ddd6b8b614b86 100644 (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;
-}
index 01648e32aa18aec06e3c54db5ecfaefbe46b2b02..0a6f9f21799a7ae8bc5383e24a34a9156f05afca 100644 (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
index c7f9dc355b7177789eee4b7a89d375c05efbc67c..e75c987f9e295c528e7cde0f0beab2b9fb06f19e 100644 (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 );
 }