Salome HOME
IPAL9154
authorasl <asl@opencascade.com>
Tue, 14 Jun 2005 06:25:33 +0000 (06:25 +0000)
committerasl <asl@opencascade.com>
Tue, 14 Jun 2005 06:25:33 +0000 (06:25 +0000)
src/SMESHGUI/SMESHGUI.cxx
src/SMESHGUI/SMESHGUI.h
src/SMESHGUI/SMESHGUI_VTKUtils.cxx
src/SMESHGUI/SMESHGUI_VTKUtils.h

index 6f22f89613b8334cd2e9aabe7fe9c3b9165c2a9b..1c17f26c44db7f3fcbfa72371d386ff67a4cd055 100644 (file)
 #include <SVTK_ViewWindow.h>
 #include <SVTK_ViewModel.h>
 
 #include <SVTK_ViewWindow.h>
 #include <SVTK_ViewModel.h>
 
+#include <VTKViewer_ViewManager.h>
+
 #include "SMESHGUI_Utils.h"
 #include "SMESHGUI_GEOMGenUtils.h"
 #include "SMESHGUI_MeshUtils.h"
 #include "SMESHGUI_Utils.h"
 #include "SMESHGUI_GEOMGenUtils.h"
 #include "SMESHGUI_MeshUtils.h"
@@ -1812,7 +1814,7 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
        mgr->setValue( "SMESH", "SettingsElementsSelectTol", aTolItems );
 
        // update current study settings
        mgr->setValue( "SMESH", "SettingsElementsSelectTol", aTolItems );
 
        // update current study settings
-       SMESH::UpdateSelectionProp();
+       SMESH::UpdateSelectionProp( this );
 
        if( vtkwnd ) {
          // update VTK viewer properties
 
        if( vtkwnd ) {
          // update VTK viewer properties
@@ -2304,7 +2306,6 @@ bool SMESHGUI::OnKeyPress( QKeyEvent * pe, SUIT_ViewWindow * wnd )
 //=============================================================================
 bool SMESHGUI::SetSettings(SUIT_Desktop* parent)
 {
 //=============================================================================
 bool SMESHGUI::SetSettings(SUIT_Desktop* parent)
 {
-  MESSAGE("SMESHGUI::SetSettings.");
   SMESHGUI::GetSMESHGUI();
   
   SUIT_ResourceMgr* mgr = resourceMgr();
   SMESHGUI::GetSMESHGUI();
   
   SUIT_ResourceMgr* mgr = resourceMgr();
@@ -2343,6 +2344,7 @@ bool SMESHGUI::SetSettings(SUIT_Desktop* parent)
     action( 10001 )->setOn( false );
     action( 10003 )->setOn( true );
   }
     action( 10001 )->setOn( false );
     action( 10003 )->setOn( true );
   }
+
   action( 10003 )->setOn( Shrink );
 
   // Automatic Update
   action( 10003 )->setOn( Shrink );
 
   // Automatic Update
@@ -2361,10 +2363,12 @@ bool SMESHGUI::SetSettings(SUIT_Desktop* parent)
     action( 10071 )->setOn( false );
 
   // Selection
     action( 10071 )->setOn( false );
 
   // Selection
-  SMESH::UpdateSelectionProp();
+  SMESH::UpdateSelectionProp( this );
 
   // menus disable
 
   // menus disable
-  //action( 111 )->setEnabled( false );        // IMPORT DAT
+  action( 111 )->setEnabled( false );  // IMPORT DAT
+
+  //action( 112 )->setEnabled( false );
   //parent->menuBar()->setItemEnabled(112, false);     // IMPORT UNV
 
   return true;
   //parent->menuBar()->setItemEnabled(112, false);     // IMPORT UNV
 
   return true;
@@ -3016,6 +3020,9 @@ void SMESHGUI::initialize( CAM_Application* app )
   popupMgr()->setRule( action( 302 ), aRule + "&&" + isNotEmpty, true );
 
   popupMgr()->insert( separator(), -1, -1 );
   popupMgr()->setRule( action( 302 ), aRule + "&&" + isNotEmpty, true );
 
   popupMgr()->insert( separator(), -1, -1 );
+
+  connect( application(), SIGNAL( viewManagerAdded( SUIT_ViewManager* ) ), 
+          this, SLOT( onViewManagerAdded( SUIT_ViewManager* ) ) );
 }
 
 bool SMESHGUI::activateModule( SUIT_Study* study )
 }
 
 bool SMESHGUI::activateModule( SUIT_Study* study )
@@ -3024,9 +3031,9 @@ bool SMESHGUI::activateModule( SUIT_Study* study )
 
   setMenuShown( true );
   setToolShown( true );
 
   setMenuShown( true );
   setToolShown( true );
+  SetSettings( desktop() );
 
   return res;
 
   return res;
-  //SetSettings( desktop() );
 }
 
 bool SMESHGUI::deactivateModule( SUIT_Study* study )
 }
 
 bool SMESHGUI::deactivateModule( SUIT_Study* study )
@@ -3078,3 +3085,9 @@ void SMESHGUI::viewManagers( QStringList& list ) const
 {
   list.append( SVTK_Viewer::Type() );
 }
 {
   list.append( SVTK_Viewer::Type() );
 }
+
+void SMESHGUI::onViewManagerAdded( SUIT_ViewManager* mgr )
+{
+  if( dynamic_cast<VTKViewer_ViewManager*>( mgr ) )
+    SMESH::UpdateSelectionProp( this );
+}
index c99de05d20cb84cd1a3cc098313d8d3047dc0467..ec883cab7c9a797193597ced12848056244a14ee 100644 (file)
@@ -102,6 +102,7 @@ public slots:
 
 private slots:
   void OnGUIEvent();
 
 private slots:
   void OnGUIEvent();
+  void onViewManagerAdded( SUIT_ViewManager* );
 
 signals:
   void SignalDeactivateActiveDialog() ;
 
 signals:
   void SignalDeactivateActiveDialog() ;
index b918db58dd3b97815a6eda2571f020e04a26a026..734a076009731713ec90ee83b9aecfebc9e07411 100644 (file)
@@ -416,13 +416,32 @@ namespace SMESH{
   }
 
 
   }
 
 
-  void UpdateSelectionProp() {
-    SUIT_Study* aStudy = GetActiveStudy();
-    SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( aStudy->application() );
+  void UpdateSelectionProp( SMESHGUI* theModule ) {
+    if( !theModule )
+      return;
+
+    SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( theModule->application() );
+    if( !app )
+    {
+      MESSAGE( "UpdateSelectionProp: Application is null" );
+      return;
+    }
+
     SUIT_ViewManager* vm = app->activeViewManager();
     SUIT_ViewManager* vm = app->activeViewManager();
+    if( !vm )
+    {
+      MESSAGE( "UpdateSelectionProp: View manager is null" );
+      return;
+    }
+
     QPtrVector<SUIT_ViewWindow> views = vm->getViews();
 
     QPtrVector<SUIT_ViewWindow> views = vm->getViews();
 
-    SUIT_ResourceMgr* mgr = SMESHGUI::resourceMgr();
+    SUIT_ResourceMgr* mgr = SMESH::GetResourceMgr( theModule );
+    if( !mgr )
+    {
+      MESSAGE( "UpdateSelectionProp: Resource manager is null" );
+      return;
+    }
 
     QColor aHiColor = mgr->colorValue( "SMESH", "SettingsSelectColor", Qt::white ),
            aSelColor = mgr->colorValue( "SMESH", "SettingsItemSelectColor", Qt::yellow ),
 
     QColor aHiColor = mgr->colorValue( "SMESH", "SettingsSelectColor", Qt::white ),
            aSelColor = mgr->colorValue( "SMESH", "SettingsItemSelectColor", Qt::yellow ),
index ec68ea5b11a909cd2b39a306f92116f20c3ba302..f94695cd58bd313e827965d3afc549aae22e2922 100644 (file)
@@ -39,6 +39,7 @@ class SVTK_ViewWindow;
 class SVTK_Selector;
 
 class SalomeApp_SelectionMgr;
 class SVTK_Selector;
 
 class SalomeApp_SelectionMgr;
+class SMESHGUI;
 
 #include <CORBA.h>
 
 
 #include <CORBA.h>
 
@@ -114,7 +115,7 @@ namespace SMESH{
 
   void SetPickable(SMESH_Actor* theActor = NULL);
 
 
   void SetPickable(SMESH_Actor* theActor = NULL);
 
-  void UpdateSelectionProp();
+  void UpdateSelectionProp( SMESHGUI* );
 
 
   //----------------------------------------------------------------------------
 
 
   //----------------------------------------------------------------------------