Salome HOME
*** empty log message ***
authorasl <asl@opencascade.com>
Wed, 8 Jun 2005 10:45:19 +0000 (10:45 +0000)
committerasl <asl@opencascade.com>
Wed, 8 Jun 2005 10:45:19 +0000 (10:45 +0000)
51 files changed:
src/OBJECT/SMESH_Actor.cxx
src/OBJECT/SMESH_ActorUtils.cxx
src/OBJECT/SMESH_ActorUtils.h
src/SMESHGUI/SMESHGUI.cxx
src/SMESHGUI/SMESHGUI_AddMeshElementDlg.cxx
src/SMESHGUI/SMESHGUI_AddSubMeshDlg.cxx
src/SMESHGUI/SMESHGUI_CreateHypothesesDlg.cxx
src/SMESHGUI/SMESHGUI_CreatePatternDlg.cxx
src/SMESHGUI/SMESHGUI_DeleteGroupDlg.h
src/SMESHGUI/SMESHGUI_EditHypothesesDlg.cxx
src/SMESHGUI/SMESHGUI_ExtrusionAlongPathDlg.cxx
src/SMESHGUI/SMESHGUI_ExtrusionDlg.cxx
src/SMESHGUI/SMESHGUI_FilterDlg.cxx
src/SMESHGUI/SMESHGUI_GroupDlg.cxx
src/SMESHGUI/SMESHGUI_GroupOpDlg.cxx
src/SMESHGUI/SMESHGUI_GroupOpDlg.h
src/SMESHGUI/SMESHGUI_InitMeshDlg.cxx
src/SMESHGUI/SMESHGUI_MergeNodesDlg.cxx
src/SMESHGUI/SMESHGUI_MeshInfosDlg.cxx
src/SMESHGUI/SMESHGUI_MeshPatternDlg.cxx
src/SMESHGUI/SMESHGUI_MoveNodesDlg.cxx
src/SMESHGUI/SMESHGUI_MultiEditDlg.cxx
src/SMESHGUI/SMESHGUI_NodesDlg.cxx
src/SMESHGUI/SMESHGUI_PrecisionDlg.cxx
src/SMESHGUI/SMESHGUI_PrecisionDlg.h
src/SMESHGUI/SMESHGUI_Preferences_ColorDlg.cxx
src/SMESHGUI/SMESHGUI_Preferences_ColorDlg.h
src/SMESHGUI/SMESHGUI_Preferences_ScalarBarDlg.cxx
src/SMESHGUI/SMESHGUI_Preferences_ScalarBarDlg.h
src/SMESHGUI/SMESHGUI_Preferences_SelectionDlg.cxx
src/SMESHGUI/SMESHGUI_Preferences_SelectionDlg.h
src/SMESHGUI/SMESHGUI_RemoveElementsDlg.cxx
src/SMESHGUI/SMESHGUI_RemoveNodesDlg.cxx
src/SMESHGUI/SMESHGUI_RenumberingDlg.cxx
src/SMESHGUI/SMESHGUI_RenumberingDlg.h
src/SMESHGUI/SMESHGUI_RevolutionDlg.cxx
src/SMESHGUI/SMESHGUI_RotationDlg.cxx
src/SMESHGUI/SMESHGUI_SewingDlg.cxx
src/SMESHGUI/SMESHGUI_SingleEditDlg.cxx
src/SMESHGUI/SMESHGUI_SmoothingDlg.cxx
src/SMESHGUI/SMESHGUI_StandardMeshInfosDlg.cxx
src/SMESHGUI/SMESHGUI_StandardMeshInfosDlg.h
src/SMESHGUI/SMESHGUI_SymmetryDlg.cxx
src/SMESHGUI/SMESHGUI_TranslationDlg.cxx
src/SMESHGUI/SMESHGUI_TransparencyDlg.cxx
src/SMESHGUI/SMESHGUI_TransparencyDlg.h
src/SMESHGUI/SMESHGUI_Utils.cxx
src/SMESHGUI/SMESHGUI_Utils.h
src/SMESHGUI/SMESHGUI_aParameterDlg.cxx
src/SMESHGUI/SMESHGUI_aParameterDlg.h
src/StdMeshersGUI/StdMeshersGUI.cxx

index 3db87dba4085d86f0f466b5e1c53d3a2befcff10..7bea5e30b0f153a15719ac0ba42dfc96f0a1977e 100644 (file)
@@ -33,7 +33,9 @@
 #include "SMESH_ControlsDef.hxx"
 #include <VTKViewer_ExtractUnstructuredGrid.h>
 
-//#include "QAD_Config.h"
+#include "SUIT_Session.h"
+#include "SUIT_ResourceMgr.h"
+
 #include <qstringlist.h>
 
 #include <vtkTimeStamp.h>
@@ -288,38 +290,38 @@ SMESH_ActorDef::SMESH_ActorDef()
 
   vtkTextProperty* aScalarBarTitleProp = vtkTextProperty::New();
 
-/*  if ( QAD_CONFIG->hasSetting( "SMESH:ScalarBarTitleColor" ) ) {
-    QStringList aTColor = QStringList::split(  ":", QAD_CONFIG->getSetting( "SMESH:ScalarBarTitleColor" ), false );
-    aScalarBarTitleProp->SetColor( ( aTColor.count() > 0 ? aTColor[0].toInt()/255. : 1.0 ),
-                                  ( aTColor.count() > 1 ? aTColor[1].toInt()/255. : 1.0 ),
-                                  ( aTColor.count() > 2 ? aTColor[2].toInt()/255. : 1.0 ) );
-  }
-  else*/
-    aScalarBarTitleProp->SetColor( 1.0, 1.0, 1.0 );
+  SUIT_ResourceMgr* mgr = SUIT_Session::session()->resourceMgr();
+  if( !mgr )
+    return;
+
+  QColor aTColor = mgr->colorValue( "ScalarBarTitleColor", "SMESH", QColor( 255, 255, 255 ) );
+  aScalarBarTitleProp->SetColor( aTColor.red()/255., aTColor.green()/255., aTColor.blue()/255. );
 
   aScalarBarTitleProp->SetFontFamilyToArial();
-  /*if( QAD_CONFIG->hasSetting( "SMESH:ScalarBarTitleFont" ) ){
-    if ( QAD_CONFIG->getSetting( "SMESH:ScalarBarTitleFont" ) == "Arial" )
+  
+  if( mgr->hasValue( "ScalarBarTitleFont", "SMESH" ) ){
+    QString str = mgr->stringValue( "ScalarBarTitleFont", "SMESH" );
+    if ( str == "Arial" )
       aScalarBarTitleProp->SetFontFamilyToArial();
-    else if ( QAD_CONFIG->getSetting( "SMESH:ScalarBarTitleFont" ) == "Courier" )
+    else if ( str == "Courier" )
       aScalarBarTitleProp->SetFontFamilyToCourier();
-    else if ( QAD_CONFIG->getSetting( "SMESH:ScalarBarTitleFont" ) == "Times" )
+    else if ( str == "Times" )
       aScalarBarTitleProp->SetFontFamilyToTimes();
-  }*/
+  }
 
-  /*if ( QAD_CONFIG->getSetting( "SMESH:ScalarBarTitleBold" ) == "true" )
+  if ( mgr->stringValue( "ScalarBarTitleBold", "SMESH" ) == "true" )
     aScalarBarTitleProp->BoldOn();
-  else*/
+  else
     aScalarBarTitleProp->BoldOff();
 
-  /*if ( QAD_CONFIG->getSetting( "SMESH:ScalarBarTitleItalic" ) == "true" )
+  if ( mgr->stringValue( "ScalarBarTitleItalic", "SMESH" ) == "true" )
     aScalarBarTitleProp->ItalicOn();
-  else*/
+  else
     aScalarBarTitleProp->ItalicOff();
 
-  /*if ( QAD_CONFIG->getSetting( "SMESH:ScalarBarTitleShadow" ) == "true" )
+  if ( mgr->stringValue( "ScalarBarTitleShadow", "SMESH" ) == "true" )
     aScalarBarTitleProp->ShadowOn();
-  else*/
+  else
     aScalarBarTitleProp->ShadowOff();
 
   myScalarBarActor->SetTitleTextProperty( aScalarBarTitleProp );
@@ -327,75 +329,71 @@ SMESH_ActorDef::SMESH_ActorDef()
 
   vtkTextProperty* aScalarBarLabelProp = vtkTextProperty::New();
 
-  /*if ( QAD_CONFIG->hasSetting( "SMESH:ScalarBarLabelColor" ) ) {
-    QStringList aTColor = QStringList::split(  ":", QAD_CONFIG->getSetting( "SMESH:ScalarBarLabelColor" ), false );
-    aScalarBarLabelProp->SetColor( ( aTColor.count() > 0 ? aTColor[0].toInt()/255. : 1.0 ),
-                                  ( aTColor.count() > 1 ? aTColor[1].toInt()/255. : 1.0 ),
-                                  ( aTColor.count() > 2 ? aTColor[2].toInt()/255. : 1.0 ) );
-  }
-  else*/
-    aScalarBarLabelProp->SetColor( 1.0, 1.0, 1.0 );
+  aTColor = mgr->colorValue( "ScalarBarLabelColor", "SMESH", QColor( 255, 255, 255 ) );
+  aScalarBarLabelProp->SetColor( aTColor.red()/255., aTColor.green()/255., aTColor.blue()/255. );
 
   aScalarBarLabelProp->SetFontFamilyToArial();
-  /*if( QAD_CONFIG->hasSetting( "SMESH:ScalarBarLabelFont" ) ){
-    if ( QAD_CONFIG->getSetting( "SMESH:ScalarBarLabelFont" ) == "Arial" )
+  if( mgr->hasValue( "ScalarBarLabelFont", "SMESH" ) )
+  {
+    QString str = mgr->stringValue( "ScalarBarLabelFont", "SMESH" );
+    if( str == "Arial" )
       aScalarBarLabelProp->SetFontFamilyToArial();
-    else if ( QAD_CONFIG->getSetting( "SMESH:ScalarBarLabelFont" ) == "Courier" )
+    else if( str == "Courier" )
       aScalarBarLabelProp->SetFontFamilyToCourier();
-    else if ( QAD_CONFIG->getSetting( "SMESH:ScalarBarLabelFont" ) == "Times" )
+    else if( str == "Times" )
       aScalarBarLabelProp->SetFontFamilyToTimes();
-  }*/
+  }
 
-  /*if ( QAD_CONFIG->getSetting( "SMESH:ScalarBarLabelBold" ) == "true" )
+  if( mgr->stringValue( "ScalarBarLabelBold", "SMESH" ) == "true" )
     aScalarBarLabelProp->BoldOn();
-  else*/
+  else
     aScalarBarLabelProp->BoldOff();
 
-  /*if ( QAD_CONFIG->getSetting( "SMESH:ScalarBarLabelItalic" ) == "true" )
+  if ( mgr->stringValue( "ScalarBarLabelItalic", "SMESH" ) == "true" )
     aScalarBarLabelProp->ItalicOn();
-  else*/
+  else
     aScalarBarLabelProp->ItalicOff();
 
-  /*if ( QAD_CONFIG->getSetting( "SMESH:ScalarBarLabelShadow" ) == "true" )
+  if( mgr->stringValue( "ScalarBarLabelShadow", "SMESH" ) == "true" )
     aScalarBarLabelProp->ShadowOn();
-  else*/
+  else
     aScalarBarLabelProp->ShadowOff();
 
   myScalarBarActor->SetLabelTextProperty( aScalarBarLabelProp );
   aScalarBarLabelProp->Delete();
 
-  /*if ( QAD_CONFIG->getSetting("SMESH:ScalarBarOrientation") == "Horizontal" )
+  if( mgr->stringValue( "ScalarBarOrientation", "SMESH" ) == "Horizontal" )
     myScalarBarActor->SetOrientationToHorizontal();
-  else*/
+  else
     myScalarBarActor->SetOrientationToVertical();
 
-  float aXVal = 0.01; //QAD_CONFIG->getSetting("SMESH:ScalarBarOrientation") == "Horizontal" ? 0.20 : 0.01;
-  //if ( QAD_CONFIG->hasSetting( "SMESH:ScalarBarXPosition" ) )
-  //  aXVal = QAD_CONFIG->getSetting( "SMESH:ScalarBarXPosition" ).toFloat();
-  float aYVal = 0.1; //QAD_CONFIG->getSetting("SMESH:ScalarBarOrientation") == "Horizontal" ? 0.01 : 0.1;
-  //if ( QAD_CONFIG->hasSetting( "SMESH:ScalarBarYPosition" ) )
-  //  aYVal = QAD_CONFIG->getSetting( "SMESH:ScalarBarYPosition" ).toFloat();
+  float aXVal = mgr->stringValue( "ScalarBarOrientation", "SMESH" ) == "Horizontal" ? 0.20 : 0.01;
+  if( mgr->hasValue( "ScalarBarXPosition", "SMESH" ) )
+    aXVal = mgr->doubleValue( "ScalarBarXPosition", "SMESH", aXVal );
+  float aYVal = mgr->stringValue( "ScalarBarOrientation", "SMESH" ) == "Horizontal" ? 0.01 : 0.1;
+  if( mgr->hasValue( "ScalarBarYPosition", "SMESH" ) )
+    aYVal = mgr->doubleValue( "ScalarBarYPosition", "SMESH", aYVal );
   myScalarBarActor->SetPosition( aXVal, aYVal );
 
-  float aWVal = 0.1; //QAD_CONFIG->getSetting("SMESH:ScalarBarOrientation") == "Horizontal" ? 0.60 : 0.10;
-  //if ( QAD_CONFIG->hasSetting( "SMESH:ScalarBarWidth" ) )
-  //  aWVal = QAD_CONFIG->getSetting( "SMESH:ScalarBarWidth" ).toFloat();
+  float aWVal = mgr->stringValue( "ScalarBarOrientation", "SMESH" ) == "Horizontal" ? 0.60 : 0.10;
+  if( mgr->hasValue( "ScalarBarWidth", "SMESH" ) )
+    aWVal = mgr->doubleValue( "ScalarBarWidth", "SMESH", aWVal );
   myScalarBarActor->SetWidth( aWVal );
 
-  float aHVal = 0.8; //QAD_CONFIG->getSetting("SMESH:ScalarBarOrientation") == "Horizontal" ? 0.12 : 0.80;
-  //if ( QAD_CONFIG->hasSetting( "SMESH:ScalarBarHeight" ) )
-  //  aHVal = QAD_CONFIG->getSetting( "SMESH:ScalarBarHeight" ).toFloat();
+  float aHVal = mgr->stringValue( "ScalarBarOrientation", "SMESH" ) == "Horizontal" ? 0.12 : 0.80;
+  if( mgr->hasValue( "ScalarBarHeight", "SMESH" ) )
+    aHVal = mgr->doubleValue( "ScalarBarHeight", "SMESH", aHVal );
   myScalarBarActor->SetHeight( aHVal );
 
   int anIntVal = 5;
-  //if ( QAD_CONFIG->hasSetting( "SMESH:ScalarBarNbOfLabels" ) )
-  //  anIntVal = QAD_CONFIG->getSetting("SMESH:ScalarBarNbOfLabels").toInt();
-  myScalarBarActor->SetNumberOfLabels(anIntVal == 0? 5: anIntVal);
+  if( mgr->hasValue( "ScalarBarNbOfLabels", "SMESH" ) )
+    anIntVal = mgr->integerValue( "ScalarBarNbOfLabels", "SMESH", anIntVal );
+  myScalarBarActor->SetNumberOfLabels( anIntVal == 0 ? 5: anIntVal );
 
   anIntVal = 64;
-  //if ( QAD_CONFIG->hasSetting( "SMESH:ScalarBarNbOfColors" ) )
-  //  anIntVal = QAD_CONFIG->getSetting("SMESH:ScalarBarNbOfColors").toInt();
-  myScalarBarActor->SetMaximumNumberOfColors(anIntVal == 0? 64: anIntVal);
+  if( mgr->hasValue( "ScalarBarNbOfColors", "SMESH" ) )
+    anIntVal = mgr->integerValue( "ScalarBarNbOfColors", "SMESH", anIntVal );
+  myScalarBarActor->SetMaximumNumberOfColors( anIntVal == 0 ? 64 : anIntVal );
 
 
   //Definition of points numbering pipeline
@@ -622,8 +620,12 @@ SMESH_ActorDef::
 SetControlMode(eControl theMode,
               bool theCheckEntityMode)
 {
+  SUIT_ResourceMgr* mgr = SUIT_Session::session()->resourceMgr();  
+  if( !mgr )
+    return;
+
   myControlMode = eNone;
-  //theCheckEntityMode &= QAD_CONFIG->getSetting("SMESH:DispayEntity") == "true";
+  theCheckEntityMode &= mgr->stringValue( "DispayEntity", "SMESH" ) == "true";
 
   my1DActor->GetMapper()->SetScalarVisibility(false);
   my2DActor->GetMapper()->SetScalarVisibility(false);
@@ -850,10 +852,14 @@ bool SMESH_ActorDef::Init(TVisualObjPtr theVisualObj,
 
   //SetIsShrunkable(theGrid->GetNumberOfCells() > 10);
   SetIsShrunkable(true);
-  
-  //QString aMode = QAD_CONFIG->getSetting("SMESH:DisplayMode");
+
+  SUIT_ResourceMgr* mgr = SUIT_Session::session()->resourceMgr();
+  if( !mgr )
+    return false;
+
+  QString aMode = mgr->stringValue( "DisplayMode", "SMESH" );
   SetRepresentation(-1);
-  /*
+  
   if(aMode.compare("Wireframe") == 0){
     SetRepresentation(eEdge);
   }else if(aMode.compare("Shading") == 0){
@@ -861,11 +867,11 @@ bool SMESH_ActorDef::Init(TVisualObjPtr theVisualObj,
   }else if(aMode.compare("Nodes") == 0){
     SetRepresentation(ePoint);
   }
-  */
-  /*aMode = QAD_CONFIG->getSetting("SMESH:Shrink");
+  
+  aMode = mgr->stringValue( "Shrink", "SMESH" );
   if(aMode == "yes"){
     SetShrink();
-  }*/
+  }
 
   myTimeStamp->Modified();
   Modified();
index 7e71257b264a4ed94802014e0adc0f33d5ada02e..05aa47c5938ead514f8aa70b367ee3a8d72c099b 100644 (file)
@@ -20,7 +20,9 @@
 
 #include "SMESH_ActorUtils.h"
 
-//#include "QAD_Config.h"
+#include "SUIT_ResourceMgr.h"
+#include "SUIT_Session.h"
+
 #include "utilities.h"
 
 #include <vtkUnstructuredGrid.h>
@@ -34,12 +36,28 @@ static int MYDEBUG = 0;
 
 namespace SMESH{
 
-  float GetFloat(const QString& theValue, float theDefault){
-    if(theValue.isEmpty()) return theDefault;
-    //QString aValue = QAD_CONFIG->getSetting(theValue);
-    //if(aValue.isEmpty())
-      return theDefault;
-    //return aValue.toFloat();
+  float GetFloat( const QString& theValue, float theDefault )
+  {
+    int pos = theValue.find( ":" );
+    float val = theDefault;
+    if( pos>=0 ) 
+    {
+      QString val = theValue.right( theValue.length()-pos-1 ),
+              sect = theValue.left( pos );
+      if( !val.isEmpty() && !sect.isEmpty() )
+       val = GetFloat( val, sect, theDefault );
+    }
+    return val;
+  }
+
+  float GetFloat( const QString& theValue, const QString& theSection, float theDefault )
+  {
+    float val = theDefault;
+    SUIT_ResourceMgr* mgr = SUIT_Session::session()->resourceMgr();
+    if( mgr )
+      val = (float) mgr->doubleValue( theValue, theSection, theDefault );
+
+    return val;
   }
 
   void WriteUnstructuredGrid(vtkUnstructuredGrid* theGrid, const char* theFileName){
index b9a01e003fdb9e8250cdf8dabd776e3be6c7a30b..b4f8194c54cc9c6eda8fc29eedd9f98906515886 100644 (file)
@@ -26,7 +26,8 @@ class vtkUnstructuredGrid;
 
 namespace SMESH{
   
-  float GetFloat(const QString& theValue, float theDefault = 0);
+  float GetFloat( const QString& theValue, float theDefault = 0 );
+  float GetFloat( const QString& theName, const QString& theSection, float theDefault = 0 );
 
   void WriteUnstructuredGrid(vtkUnstructuredGrid* theGrid, const char* theFileName);
 
index 30064c21b604b455f3b4f0b36dd91ae10cde908b..0788a118f6486a9257a45bce7ebf4554d92b4dce 100644 (file)
@@ -395,7 +395,7 @@ namespace{
       }
       case 1133:{
        SMESHGUI::GetSMESHGUI()->EmitSignalDeactivateDialog();
-       new SMESHGUI_TransparencyDlg( SMESHGUI::desktop(), "", false );
+       new SMESHGUI_TransparencyDlg( SMESHGUI::GetSMESHGUI(), "", false );
        return;
       }}
       SALOME_ListIteratorOfListIO It( selected );
@@ -455,7 +455,7 @@ namespace{
              float Shrink = anActor->GetShrinkFactor();
 
              SMESHGUI_Preferences_ColorDlg *aDlg =
-               new SMESHGUI_Preferences_ColorDlg(SMESHGUI::desktop(),"");
+               new SMESHGUI_Preferences_ColorDlg( SMESHGUI::GetSMESHGUI(), "" );
              aDlg->SetColor(1, c);
              aDlg->SetColor(2, e);
              aDlg->SetColor(3, n);
@@ -511,7 +511,7 @@ namespace{
 
     SMESHGUI::GetSMESHGUI()->EmitSignalDeactivateDialog();
     SMESHGUI_Preferences_ColorDlg *aDlg =
-      new SMESHGUI_Preferences_ColorDlg(SMESHGUI::desktop(), "");
+      new SMESHGUI_Preferences_ColorDlg( SMESHGUI::GetSMESHGUI(), "" );
 
     QColor color = mgr->colorValue( "SMESH", "SettingsFillColor", QColor(0, 170, 255) );
     aDlg->SetColor(1, color);
@@ -793,8 +793,7 @@ namespace{
     aStudyBuilder->CommitCommand();
 
     /* Clear any previous selection */
-    SALOME_ListIO selected1;
-    aSel->setSelectedObjects( selected1 );
+    aSel->setSelectedObjects( SALOME_ListIO() );
 
     SMESHGUI::GetSMESHGUI()->updateObjBrowser();
   }
@@ -1149,12 +1148,7 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
     }
   case 201:
     {
-      SalomeApp_SelectionMgr *aSel = SMESHGUI::selectionMgr();
-      SALOME_ListIO selected;
-      if( aSel )
-        aSel->selectedObjects( selected );
-
-      SMESHGUI_Preferences_ScalarBarDlg::ScalarBarProperties( desktop(), aSel );
+      SMESHGUI_Preferences_ScalarBarDlg::ScalarBarProperties( this );
       break;
     }
 
@@ -1210,8 +1204,7 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
          }
        }
       }
-      SALOME_ListIO selected1;
-      aSel->setSelectedObjects( selected1 );
+      aSel->setSelectedObjects( SALOME_ListIO() );
       break;
     }
 
@@ -1674,7 +1667,7 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
       else if ( theCommandID == 811 ) aMode = SMESHGUI_GroupOpDlg::INTERSECT;
       else                            aMode = SMESHGUI_GroupOpDlg::CUT;
 
-      ( new SMESHGUI_GroupOpDlg( desktop(), SMESHGUI::selectionMgr(), aMode ) )->show();
+      ( new SMESHGUI_GroupOpDlg( this, aMode ) )->show();
       break;
     }
 
@@ -1685,7 +1678,7 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
 
       EmitSignalDeactivateDialog();
 
-      new SMESHGUI_DeleteGroupDlg(this);
+      new SMESHGUI_DeleteGroupDlg( this );
       break;
     }
 
@@ -1728,13 +1721,13 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
          IOs.Clear();
          IOs.Append( It.Value() );
          aSel->setSelectedObjects( IOs );
-          new SMESHGUI_StandardMeshInfosDlg(desktop(), "", false);
+          new SMESHGUI_StandardMeshInfosDlg( this, "", false);
         }
         // restore selection
        aSel->setSelectedObjects( selected );
       }
       else
-        new SMESHGUI_StandardMeshInfosDlg(desktop(), "", false);
+        new SMESHGUI_StandardMeshInfosDlg( this, "", false);
       break;
     } 
     
@@ -1759,13 +1752,13 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
 
   case 1005:
     {
-      SMESHGUI_Preferences_ScalarBarDlg::ScalarBarPreferences( desktop() );
+      SMESHGUI_Preferences_ScalarBarDlg::ScalarBarPreferences( this );
       break;
     }
 
   case 10070:
     {
-      ( new SMESHGUI_PrecisionDlg( desktop() ) )->exec();
+      ( new SMESHGUI_PrecisionDlg( this ) )->exec();
       break;
     }
 
@@ -1782,7 +1775,7 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
   case 1006:
     {
       SMESHGUI_Preferences_SelectionDlg* aDlg = 
-       new SMESHGUI_Preferences_SelectionDlg(desktop());
+       new SMESHGUI_Preferences_SelectionDlg( this );
 
       QColor aColor = mgr->colorValue( "SMESH", "SettingsPreSelectColor", Qt::cyan );
       aDlg->SetColor(1, aColor);
@@ -1944,8 +1937,7 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
        Handle(SALOME_InteractiveObject) IObject = It.Value();
        SMESH::RemoveHypothesisOrAlgorithmOnMesh(IObject);
       }
-      SALOME_ListIO selected1;
-      aSel->setSelectedObjects( selected1 );
+      aSel->setSelectedObjects( SALOME_ListIO() );
       updateObjBrowser();
       break;
     }
@@ -2034,7 +2026,7 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
       if(checkLock(aStudy)) break;
       if( vtkwnd ) {
        EmitSignalDeactivateDialog();
-       new SMESHGUI_RenumberingDlg(desktop(), "", selectionMgr(), 0);
+       new SMESHGUI_RenumberingDlg( this, "", 0);
       }
       else
        {
@@ -2049,7 +2041,7 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
       if(checkLock(aStudy)) break;
       if ( vtkwnd ) {
        EmitSignalDeactivateDialog();
-       new SMESHGUI_RenumberingDlg(desktop(), "", selectionMgr(), 1);
+       new SMESHGUI_RenumberingDlg( this, "", 1);
       }
       else
        {
index a15542896d3dc1096a00767baafa98bea2f529b3..8226cdc6a7470801d4f96923479c78c8ed2aedb7 100644 (file)
@@ -268,8 +268,8 @@ SMESHGUI_AddMeshElementDlg::SMESHGUI_AddMeshElementDlg( SMESHGUI* theModule,
   QString caption       = tr(QString("SMESH_ADD_%1_TITLE").arg(elemName));
   QString grBoxTitle    = tr(QString("SMESH_ADD_%1").arg(elemName));
 
-  QPixmap image0 (SMESHGUI::resourceMgr()->loadPixmap("SMESH", iconName));
-  QPixmap image1 (SMESHGUI::resourceMgr()->loadPixmap("SMESH", tr("ICON_SELECT")));
+  QPixmap image0 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", iconName));
+  QPixmap image1 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_SELECT")));
 
   if (!name)
     setName("SMESHGUI_AddMeshElementDlg");
index b07345819021b6a48562734c4945a3670f6a71ba..79cbb32c07aa6ce30955ce618cdd2c75dd486f26 100644 (file)
@@ -94,7 +94,7 @@ SMESHGUI_AddSubMeshDlg::SMESHGUI_AddSubMeshDlg( SMESHGUI* theModule, const char*
      mySMESHGUI( theModule ),
      mySelectionMgr( SMESH::GetSelectionMgr( theModule ) )
 {
-    QPixmap image0 (SMESHGUI::resourceMgr()->loadPixmap("SMESH", tr("ICON_SELECT")));
+    QPixmap image0 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_SELECT")));
     if (!name)
       setName("SMESHGUI_AddSubMeshDlg");
     setCaption(tr("SMESH_ADD_SUBMESH"));
index 5e3e4b090218e6eae58a8fbf50876f3f7b547271..68d2f10c8844c1230c7f31d15ee8c5e6d80de649 100644 (file)
@@ -287,7 +287,7 @@ void SMESHGUI_CreateHypothesesDlg::InitAlgoDefinition()
       parentItem = new QListViewItem(ListAlgoDefinition, aHypData->PluginName);
     parentItem->setOpen(true);
     QListViewItem* aItem = new QListViewItem(parentItem, aHypData->Label, HypList[i]);
-    QPixmap aPixMap (SMESHGUI::resourceMgr()->loadPixmap("SMESH", tr(aHypData->IconId)));
+    QPixmap aPixMap (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr(aHypData->IconId)));
     if (!aPixMap.isNull())
       aItem->setPixmap(0, aPixMap);
   }
index a7990a79ac0792e8255352bf4fbefb511e1d89dd..28bb9ad0c5e05707628d1398d5994fee150ab6d1 100755 (executable)
-//  SMESH SMESHGUI : GUI for SMESH component
-//
-//  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-//  This library is free software; you can redistribute it and/or
-//  modify it under the terms of the GNU Lesser General Public
-//  License as published by the Free Software Foundation; either
-//  version 2.1 of the License.
-//
-//  This library is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-//  Lesser General Public License for more details.
-//
-//  You should have received a copy of the GNU Lesser General Public
-//  License along with this library; if not, write to the Free Software
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
-//
-//  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
-//
-//
-//
-//  File   : SMESHGUI_CreatePatternDlg.cxx
-//  Author : Sergey LITONIN
-//  Module : SMESH
-
-#include "SMESHGUI_CreatePatternDlg.h"
-
-#include "SMESHGUI.h"
-#include "SMESHGUI_SpinBox.h"
-#include "SMESHGUI_PatternWidget.h"
-#include "SMESHGUI_Utils.h"
-#include "SMESHGUI_VTKUtils.h"
-#include "SMESHGUI_PatternUtils.h"
-#include "SMESHGUI_GEOMGenUtils.h"
-
-#include "SMESH_NumberFilter.hxx"
-
-#include "SUIT_ResourceMgr.h"
-#include "SUIT_Desktop.h"
-#include "SUIT_FileDlg.h"
-
-#include "SalomeApp_Study.h"
-#include "SalomeApp_DataOwner.h"
-#include "SalomeApp_SelectionMgr.h"
-#include "SalomeApp_Tools.h"
-
-#include "SALOMEDS_SObject.hxx"
-
-#include "SALOME_ListIO.hxx"
-#include "SVTK_ViewModel.h"
-#include "SVTK_ViewWindow.h"
-#include "SVTK_Selector.h"
-#include "SVTK_Selection.h"
-
-// OCCT Includes
-#include <TColStd_MapOfInteger.hxx>
-
-// QT Includes
-#include <qframe.h>
-#include <qlayout.h>
-#include <qlineedit.h>
-#include <qpushbutton.h>
-#include <qgroupbox.h>
-#include <qlabel.h>
-#include <qradiobutton.h>
-#include <qcheckbox.h>
-#include <qbuttongroup.h>
-#include <qmessagebox.h>
-#include <qapplication.h>
-
-#define SPACING 5
-#define MARGIN  10
-
-/*!
- *  Class       : SMESHGUI_CreatePatternDlg
- *  Description : Dialog to specify filters for VTK viewer
- */
-
-//=======================================================================
-// function : SMESHGUI_CreatePatternDlg()
-// purpose  : Constructor
-//=======================================================================
-SMESHGUI_CreatePatternDlg::SMESHGUI_CreatePatternDlg( SMESHGUI*   theModule,
-                                                      const int   theType,
-                                                      const char* theName)
-     : QDialog( SMESH::GetDesktop( theModule ), theName, false,
-                WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu),
-     mySMESHGUI( theModule ),
-     mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ),
-     myViewWindow( SMESH::GetViewWindow( theModule ) ),
-     mySelector( myViewWindow->GetSelector() )
-{
-  setCaption(tr("CAPTION"));
-
-  QVBoxLayout* aDlgLay = new QVBoxLayout (this, MARGIN, SPACING);
-
-  QFrame* aMainFrame = createMainFrame  (this);
-  QFrame* aBtnFrame  = createButtonFrame(this);
-
-  aDlgLay->addWidget(aMainFrame);
-  aDlgLay->addWidget(aBtnFrame);
-
-  aDlgLay->setStretchFactor(aMainFrame, 1);
-
-  Init(theType);
-}
-
-//=======================================================================
-// function : createMainFrame()
-// purpose  : Create frame containing dialog's input fields
-//=======================================================================
-QFrame* SMESHGUI_CreatePatternDlg::createMainFrame (QWidget* theParent)
-{
-  QPixmap iconSlct     (SMESHGUI::resourceMgr()->loadPixmap("SMESH", tr("ICON_SELECT")));
-  QPixmap icon2d       (SMESHGUI::resourceMgr()->loadPixmap("SMESH", tr("ICON_PATTERN_2d")));
-  QPixmap icon3d       (SMESHGUI::resourceMgr()->loadPixmap("SMESH", tr("ICON_PATTERN_3d")));
-  QPixmap iconSample2d (SMESHGUI::resourceMgr()->loadPixmap("SMESH", tr("ICON_PATTERN_SAMPLE_2D")));
-
-  QGroupBox* aMainGrp = new QGroupBox(1, Qt::Horizontal, theParent);
-  aMainGrp->setFrameStyle(QFrame::NoFrame);
-  aMainGrp->setInsideMargin(0);
-
-  // Pattern type group
-
-  myTypeGrp = new QButtonGroup (1, Qt::Vertical, tr("PATTERN_TYPE"), aMainGrp);
-  mySwitch2d = new QRadioButton (myTypeGrp);
-  mySwitch3d = new QRadioButton (myTypeGrp);
-  mySwitch2d->setPixmap(icon2d);
-  mySwitch3d->setPixmap(icon3d);
-  myTypeGrp->insert(mySwitch2d, Type_2d);
-  myTypeGrp->insert(mySwitch3d, Type_3d);
-
-  QGroupBox* aPatternGrp = new QGroupBox(1, Qt::Horizontal, tr("PATTERN"), aMainGrp);
-
-  // Mesh and pattern name group
-
-  QGroupBox* aMeshGrp = new QGroupBox(1, Qt::Vertical, aPatternGrp);
-  aMeshGrp->setFrameStyle(QFrame::NoFrame);
-  aMeshGrp->setInsideMargin(0);
-
-  new QLabel(tr("MESH_OR_SUBMESH"), aMeshGrp);
-
-  QPushButton* aSelBtn = new QPushButton(aMeshGrp);
-  aSelBtn->setPixmap(iconSlct);
-  myMeshEdit = new QLineEdit(aMeshGrp);
-  myMeshEdit->setReadOnly(true);
-
-  QGroupBox* aPattGrp = new QGroupBox(1, Qt::Vertical, aPatternGrp);
-  aPattGrp->setFrameStyle(QFrame::NoFrame);
-  aPattGrp->setInsideMargin(0);
-
-  new QLabel(tr("PATTERN_NAME"), aPattGrp);
-  myName = new QLineEdit(aPattGrp);
-
-  // Picture 2d
-
-  myPicture2d = new SMESHGUI_PatternWidget(aPatternGrp),
-  myPicture2d->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding));
-
-  // Project check box
-
-  myProjectChk = new QCheckBox(tr("PROJECT"), aPatternGrp);
-
-  // Connect signals and slots
-
-  connect(myTypeGrp,    SIGNAL(clicked(int) ), SLOT(onTypeChanged(int)));
-  connect(myProjectChk, SIGNAL(toggled(bool)), SLOT(onProject(bool)   ));
-  connect(aSelBtn,      SIGNAL(clicked()      ), SLOT(onSelBtnClicked()));
-
-  return aMainGrp;
-}
-
-//=======================================================================
-// function : createButtonFrame()
-// purpose  : Create frame containing buttons
-//=======================================================================
-QFrame* SMESHGUI_CreatePatternDlg::createButtonFrame (QWidget* theParent)
-{
-  QFrame* aFrame = new QFrame(theParent);
-  aFrame->setFrameStyle(QFrame::Box | QFrame::Sunken);
-
-  myOkBtn    = new QPushButton(tr("SMESH_BUT_OK"    ), aFrame);
-  mySaveBtn  = new QPushButton(tr("SAVE"            ), aFrame);
-  myCloseBtn = new QPushButton(tr("SMESH_BUT_CANCEL"), aFrame);
-
-  QSpacerItem* aSpacer = new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum);
-
-  QHBoxLayout* aLay = new QHBoxLayout(aFrame, MARGIN, SPACING);
-
-  aLay->addWidget(myOkBtn);
-  aLay->addWidget(mySaveBtn);
-  aLay->addItem(aSpacer);
-  aLay->addWidget(myCloseBtn);
-
-  connect(myOkBtn,    SIGNAL(clicked()), SLOT(onOk()));
-  connect(myCloseBtn, SIGNAL(clicked()), SLOT(onClose()));
-  connect(mySaveBtn, SIGNAL(clicked()), SLOT(onSave()));
-
-  return aFrame;
-}
-
-//=======================================================================
-// function : ~SMESHGUI_CreatePatternDlg()
-// purpose  : Destructor
-//=======================================================================
-SMESHGUI_CreatePatternDlg::~SMESHGUI_CreatePatternDlg()
-{
-  // no need to delete child widgets, Qt does it all for us
-}
-
-//=======================================================================
-// function : onProject()
-// purpose  : SLOT. Called when state of "Project nodes on ther face"
-//            checkbox is changed
-//=======================================================================
-void SMESHGUI_CreatePatternDlg::onProject (bool)
-{
-  loadFromObject(false);
-  displayPreview();
-}
-
-//=======================================================================
-// function : Init()
-// purpose  : Init dialog fields, connect signals and slots, show dialog
-//=======================================================================
-void SMESHGUI_CreatePatternDlg::Init( const int theType )
-{
-  myIsLoaded     = false;
-  myType         = -1;
-  myNbPoints     = -1;
-  mySubMesh      = SMESH::SMESH_subMesh::_nil();
-  myMesh         = SMESH::SMESH_Mesh::_nil();
-  myGeomObj      = GEOM::GEOM_Object::_nil();
-  myPattern      = SMESH::SMESH_Pattern::_nil();
-
-  erasePreview();
-
-  mySMESHGUI->SetActiveDialogBox((QDialog*)this);
-
-  // selection and SMESHGUI
-  connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), SLOT(onSelectionDone()));
-  connect(mySMESHGUI, SIGNAL(SignalDeactivateActiveDialog()), SLOT(onDeactivate()));
-  connect(mySMESHGUI, SIGNAL(SignalCloseAllDialogs()), SLOT(onClose()));
-
-  mySwitch2d->setEnabled(theType == Type_2d);
-  mySwitch3d->setEnabled(theType == Type_3d);
-
-  if (theType == Type_2d)
-    myProjectChk->show();
-  else
-    myProjectChk->hide();
-
-  myTypeGrp->setButton(theType);
-  onTypeChanged(theType);
-
-  myName->setText(getDefaultName());
-  myMeshEdit->setText("");
-
-  setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding));
-  qApp->processEvents();
-  updateGeometry();
-  myPicture2d->updateGeometry();
-  adjustSize();
-  resize(minimumSize());
-
-  activateSelection();
-  onSelectionDone();
-
-  int x, y;
-  mySMESHGUI->DefineDlgPosition(this, x, y);
-  this->move(x, y);
-  this->show();
-}
-
-//=======================================================================
-// function : SetMesh()
-// purpose  : Set mesh to dialog
-//=======================================================================
-void SMESHGUI_CreatePatternDlg::SetMesh (SMESH::SMESH_Mesh_ptr thePtr)
-{
-  myMesh = SMESH::SMESH_Mesh::_duplicate(thePtr);
-  mySubMesh = SMESH::SMESH_subMesh::_nil();
-
-  bool isValidMesh = false;
-  if (!myMesh->_is_nil())
-  {
-    _PTR(SObject) aSobj = SMESH::FindSObject(myMesh.in());
-    //Handle(SALOME_InteractiveObject) anIObj =
-    //  new SALOME_InteractiveObject(aSobj->GetID().c_str(), "SMESH");
-    SUIT_DataOwnerPtr anIObj (new SalomeApp_DataOwner(aSobj->GetID().c_str()));
-
-    isValidMesh = mySelectionMgr->isOk(anIObj);
-  }
-
-  if (isValidMesh) {
-    _PTR(SObject) aSO = SMESH::FindSObject(myMesh.in());
-    myMeshEdit->setText(aSO->GetName().c_str());
-    myGeomObj = SMESH::GetGeom(aSO);
-  } else {
-    myMeshEdit->setText("");
-    myGeomObj = GEOM::GEOM_Object::_nil();
-  }
-
-  if (myType == Type_2d) {
-    loadFromObject(false);
-    displayPreview();
-  }
-}
-
-//=======================================================================
-// function : isValid()
-// purpose  : Verify validity of entry data
-//=======================================================================
-bool SMESHGUI_CreatePatternDlg::isValid()
-{
-  if (myGeomObj->_is_nil()) {
-    QMessageBox::information(SMESH::GetDesktop( mySMESHGUI ),
-                             tr("SMESH_INSUFFICIENT_DATA"),
-                             tr("SMESHGUI_INVALID_PARAMETERS"),
-                             QMessageBox::Ok);
-    return false;
-  }
-  else
-    return true;
-}
-
-//=======================================================================
-// function : getDefaultName()
-// purpose  : Get default pattern name
-//=======================================================================
-QString SMESHGUI_CreatePatternDlg::getDefaultName() const
-{
-  return myType == Type_2d ? tr("DEFAULT_2D") : tr("DEFAULT_3D");
-}
-
-//=======================================================================
-// function : onSave()
-// purpose  : SLOT called when "Save" button pressed. Build pattern and
-//           save it to disk
-//=======================================================================
-void SMESHGUI_CreatePatternDlg::onSave()
-{
-  try {
-    if (!isValid())
-      return;
-
-    if (!myIsLoaded)
-      loadFromObject(true);
-
-    // Load pattern from object
-    if (!myIsLoaded)
-      return;
-
-    ///////////////////////////////////////////////////////
-    SUIT_FileDlg* aDlg = new SUIT_FileDlg (this, false);
-    aDlg->setCaption(tr("SAVE_PATTERN"));
-    aDlg->setMode(QFileDialog::AnyFile);
-    aDlg->setFilters(tr("PATTERN_FILT"));
-    if (myName->text() != "")
-      aDlg->setSelection(myName->text());
-
-    if (aDlg->exec() != Accepted)
-      return;
-
-    QString fName = aDlg->selectedFile();
-    if (fName.isEmpty())
-      return;
-
-    if (QFileInfo(fName).extension().isEmpty())
-      fName = autoExtension(fName);
-
-    fName = QDir::convertSeparators(fName);
-
-    QString aData (myPattern->GetString());
-    long aLen = aData.length();
-
-    QFile aFile (fName);
-    aFile.open(IO_WriteOnly);
-    long aWritten = aFile.writeBlock(aData, aLen);
-    aFile.close();
-
-    if (aWritten != aLen) {
-      QMessageBox::information(SMESH::GetDesktop( mySMESHGUI ), tr("SMESH_ERROR"),
-                               tr("ERROR_OF_SAVING"), QMessageBox::Ok);
-    } else {
-      //SUIT_Application::getDesktop()->setSelectionModes(ActorSelection);
-      myViewWindow->SetSelectionMode(ActorSelection);
-      disconnect(mySelectionMgr, 0, this, 0);
-      disconnect(mySMESHGUI, 0, this, 0);
-      mySMESHGUI->ResetState();
-      accept();
-      emit NewPattern();
-    }
-  } catch (const SALOME::SALOME_Exception& S_ex) {
-    SalomeApp_Tools::QtCatchCorbaException(S_ex);
-  } catch (...) {
-  }
-}
-
-//=======================================================================
-// function : GetPatternName()
-// purpose  : Get name of pattern
-//=======================================================================
-QString SMESHGUI_CreatePatternDlg::GetPatternName() const
-{
-  return myName->text();
-}
-
-//=======================================================================
-// function : GetPattern()
-// purpose  : Get result pattern
-//=======================================================================
-SMESH::SMESH_Pattern_ptr SMESHGUI_CreatePatternDlg::GetPattern()
-{
-  return myPattern.in();
-}
-
-//=======================================================================
-// function : onOk()
-// purpose  : SLOT called when "Ok" button pressed.
-//=======================================================================
-void SMESHGUI_CreatePatternDlg::onOk()
-{
-  try {
-    if (!isValid())
-      return;
-
-    if (!myIsLoaded)
-      loadFromObject(true);
-
-    // Load pattern from object
-    if (!myIsLoaded) {
-      return;
-    } else {
-      //SUIT_Application::getDesktop()->setSelectionModes(ActorSelection);
-      myViewWindow->SetSelectionMode(ActorSelection);
-      disconnect(mySelectionMgr, 0, this, 0);
-      disconnect(mySMESHGUI, 0, this, 0);
-      mySMESHGUI->ResetState();
-      accept();
-      emit NewPattern();
-    }
-  } catch (const SALOME::SALOME_Exception& S_ex) {
-    SalomeApp_Tools::QtCatchCorbaException(S_ex);
-  } catch (...) {
-  }
-}
-
-//=======================================================================
-// function : onClose()
-// purpose  : SLOT called when "Close" button pressed. Close dialog
-//=======================================================================
-void SMESHGUI_CreatePatternDlg::onClose()
-{
-  myViewWindow->SetSelectionMode(ActorSelection);
-  disconnect(mySelectionMgr, 0, this, 0);
-  disconnect(mySMESHGUI, 0, this, 0);
-  mySMESHGUI->ResetState();
-  reject();
-  emit Close();
-}
-
-//=======================================================================
-// function : loadFromObject()
-// purpose  : Load pattern from geom object corresponding to the mesh/submesh
-//=======================================================================
-bool SMESHGUI_CreatePatternDlg::loadFromObject (const bool theMess)
-{
-  try {
-    myIsLoaded = false;
-
-    if (myPattern->_is_nil())
-      myPattern = SMESH::GetPattern();
-
-    if (myMesh->_is_nil() && mySubMesh->_is_nil() || myGeomObj->_is_nil())
-      return false;
-
-    SMESH::SMESH_Mesh_ptr aMesh = mySubMesh->_is_nil() ? myMesh.in() : mySubMesh->GetFather();
-
-    myIsLoaded = myType == Type_2d
-      ? myPattern->LoadFromFace(aMesh, myGeomObj, myProjectChk->isChecked())
-      : myPattern->LoadFrom3DBlock(aMesh, myGeomObj);
-
-    if (!myIsLoaded && theMess) {
-      QString aMess;
-      SMESH::SMESH_Pattern::ErrorCode aCode = myPattern->GetErrorCode();
-
-      if      (aCode == SMESH::SMESH_Pattern::ERR_LOAD_EMPTY_SUBMESH  ) aMess = tr("ERR_LOAD_EMPTY_SUBMESH");
-      else if (aCode == SMESH::SMESH_Pattern::ERR_LOADF_NARROW_FACE   ) aMess = tr("ERR_LOADF_NARROW_FACE");
-      else if (aCode == SMESH::SMESH_Pattern::ERR_LOADF_CLOSED_FACE   ) aMess = tr("ERR_LOADF_CLOSED_FACE");
-      else if (aCode == SMESH::SMESH_Pattern::ERR_LOADV_BAD_SHAPE     ) aMess = tr("ERR_LOADV_BAD_SHAPE");
-      else if (aCode == SMESH::SMESH_Pattern::ERR_LOADV_COMPUTE_PARAMS) aMess = tr("ERR_LOADV_COMPUTE_PARAMS");
-      else                                                              aMess = tr("ERROR_OF_CREATION");
-
-      QMessageBox::information(SMESH::GetDesktop( mySMESHGUI ),
-                               tr("SMESH_ERROR"), aMess, QMessageBox::Ok);
-    }
-  } catch (const SALOME::SALOME_Exception& S_ex) {
-    SalomeApp_Tools::QtCatchCorbaException(S_ex);
-  }
-
-  return myIsLoaded;
-}
-
-//=======================================================================
-// function : onSelectionDone()
-// purpose  : SLOT called when selection changed
-//=======================================================================
-void SMESHGUI_CreatePatternDlg::onSelectionDone()
-{
-  try {
-    SALOME_ListIO aList;
-    mySelectionMgr->selectedObjects(aList, SVTK_Viewer::Type());
-    if (aList.Extent() != 1)
-      return;
-
-    // Get mesh or sub-mesh from selection
-    Handle(SALOME_InteractiveObject) anIO = aList.First();
-    SMESH::SMESH_Mesh_var aMesh = SMESH::IObjectToInterface<SMESH::SMESH_Mesh>(anIO);
-    SMESH::SMESH_subMesh_var aSubMesh = SMESH::IObjectToInterface<SMESH::SMESH_subMesh>(anIO);
-    if (aMesh->_is_nil() && aSubMesh->_is_nil())
-      return;
-
-    // Get geom object corresponding to the mesh
-    _PTR(SObject) aSO;
-    if (!aMesh->_is_nil())
-      aSO = SMESH::FindSObject(aMesh.in());
-    else
-      aSO = SMESH::FindSObject(aSubMesh.in());
-
-    GEOM::GEOM_Object_var aGeomObj = SMESH::GetGeom(aSO);
-    if (aGeomObj->_is_nil())
-      return;
-
-    myGeomObj = aGeomObj;
-
-    // init class fields
-    if (!aMesh->_is_nil()) {
-      myMesh = aMesh;
-      mySubMesh = SMESH::SMESH_subMesh::_nil();
-    } else {
-      mySubMesh = aSubMesh;
-      myMesh = SMESH::SMESH_Mesh::_nil();
-    }
-
-    QString aName;
-    SMESH::GetNameOfSelectedIObjects(mySelectionMgr, aName);
-    myMeshEdit->setText(aName);
-
-    if (myType == Type_2d) {
-      loadFromObject(true);
-      displayPreview();
-    }
-  } catch (...) {
-    myMesh = SMESH::SMESH_Mesh::_nil();
-    mySubMesh = SMESH::SMESH_subMesh::_nil();
-    myGeomObj = GEOM::GEOM_Object::_nil();
-    erasePreview();
-  }
-}
-
-//=======================================================================
-// function : onDeactivate()
-// purpose  : SLOT called when dialog must be deativated
-//=======================================================================
-void SMESHGUI_CreatePatternDlg::onDeactivate()
-{
-  disconnect(mySelectionMgr, 0, this, 0);
-  setEnabled(false);
-}
-
-//=======================================================================
-// function : enterEvent()
-// purpose  : Event filter
-//=======================================================================
-void SMESHGUI_CreatePatternDlg::enterEvent (QEvent*)
-{
-  mySMESHGUI->EmitSignalDeactivateDialog();
-  setEnabled(true);
-  activateSelection();
-  connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), SLOT(onSelectionDone()));
-}
-
-//=================================================================================
-// function : closeEvent()
-// purpose  : Close dialog box
-//=================================================================================
-void SMESHGUI_CreatePatternDlg::closeEvent (QCloseEvent*)
-{
-  onClose();
-}
-
-//=======================================================================
-// function : onSelBtnClicked()
-// purpose  : SLOT. Called when -> button clicked.
-//=======================================================================
-void SMESHGUI_CreatePatternDlg::onSelBtnClicked()
-{
-  onSelectionDone();
-}
-
-//================================================================
-// function : autoExtension()
-// purpose  : Append extension to the file name
-//================================================================
-QString SMESHGUI_CreatePatternDlg::autoExtension (const QString& theFileName) const
-{
-  QString anExt = theFileName.section('.', -1);
-  return anExt != "smp" && anExt != "SMP" ? theFileName + ".smp" : theFileName;
-}
-
-//=======================================================================
-// function : displayPreview()
-// purpose  : Display preview
-//=======================================================================
-void SMESHGUI_CreatePatternDlg::displayPreview()
-{
-  // Redisplay preview in dialog
-  try {
-    if (!myIsLoaded) {
-      erasePreview();
-    } else {
-      SMESH::point_array_var pnts = myPattern->GetPoints();
-      SMESH::long_array_var keyPoints = myPattern->GetKeyPoints();
-      SMESH::array_of_long_array_var elemPoints = myPattern->GetElementPoints(false);
-
-      if (pnts->length()       == 0 ||
-          keyPoints->length()  == 0 ||
-          elemPoints->length() == 0) {
-        myIsLoaded = false;
-        erasePreview();
-        return;
-      }
-
-      PointVector aPoints (pnts->length());
-      QValueVector<int> aKeyPoints (keyPoints->length());
-      ConnectivityVector anElemPoints (elemPoints->length());
-
-      for (int i = 0, n = pnts->length(); i < n; i++)
-        aPoints[ i ] = pnts[ i ];
-
-      for (int i2 = 0, n2 = keyPoints->length(); i2 < n2; i2++)
-        aKeyPoints[ i2 ] = keyPoints[ i2 ];
-
-      for (int i3 = 0, n3 = elemPoints->length(); i3 < n3; i3++) {
-        QValueVector<int> aVec (elemPoints[ i3 ].length());
-        for (int i4 = 0, n4 = elemPoints[ i3 ].length(); i4 < n4; i4++)
-          aVec[ i4 ] = elemPoints[ i3 ][ i4 ];
-
-        anElemPoints[ i3 ] = aVec;
-      }
-
-      myPicture2d->SetPoints(aPoints, aKeyPoints, anElemPoints);
-    }
-
-    return;
-
-  } catch (const SALOME::SALOME_Exception& S_ex) {
-    SalomeApp_Tools::QtCatchCorbaException(S_ex);
-  } catch (...) {
-  }
-  erasePreview();
-}
-
-//=======================================================================
-// function : erasePreview()
-// purpose  : Erase preview
-//=======================================================================
-void SMESHGUI_CreatePatternDlg::erasePreview()
-{
-  // Erase preview in 2D viewer
-  myPicture2d->SetPoints(PointVector(), QValueVector<int>(), ConnectivityVector());
-}
-
-//=======================================================================
-// function : activateSelection()
-// purpose  : Activate selection in accordance with current pattern type
-//=======================================================================
-void SMESHGUI_CreatePatternDlg::activateSelection()
-{
-  mySelectionMgr->clearFilters();
-  //SUIT_Application::getDesktop()->setSelectionModes(ActorSelection);
-  myViewWindow->SetSelectionMode(ActorSelection);
-
-  if (myType == Type_2d) {
-    mySelectionMgr->installFilter(new SMESH_NumberFilter
-      ("SMESH", TopAbs_SHAPE, -1, TopAbs_FACE));
-  } else {
-    TColStd_MapOfInteger aTypes;
-    aTypes.Add(TopAbs_SHELL);
-    aTypes.Add(TopAbs_SOLID);
-    mySelectionMgr->installFilter(new SMESH_NumberFilter
-      ("SMESH", TopAbs_FACE, 6, aTypes, GEOM::GEOM_Object::_nil(), true));
-  }
-}
-
-//=======================================================================
-// function : onTypeChanged()
-// purpose  : SLOT. Called when pattern type changed.
-//            Change dialog's look and feel
-//=======================================================================
-void SMESHGUI_CreatePatternDlg::onTypeChanged (int theType)
-{
-  if (myType == theType)
-    return;
-
-  myType = theType;
-
-  if (theType == Type_2d)
-    myPicture2d->show();
-  else
-    myPicture2d->hide();
-}
+//  SMESH SMESHGUI : GUI for SMESH component\r
+//\r
+//  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,\r
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS\r
+//\r
+//  This library is free software; you can redistribute it and/or\r
+//  modify it under the terms of the GNU Lesser General Public\r
+//  License as published by the Free Software Foundation; either\r
+//  version 2.1 of the License.\r
+//\r
+//  This library is distributed in the hope that it will be useful,\r
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\r
+//  Lesser General Public License for more details.\r
+//\r
+//  You should have received a copy of the GNU Lesser General Public\r
+//  License along with this library; if not, write to the Free Software\r
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA\r
+//\r
+//  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org\r
+//\r
+//\r
+//\r
+//  File   : SMESHGUI_CreatePatternDlg.cxx\r
+//  Author : Sergey LITONIN\r
+//  Module : SMESH\r
+\r
+#include "SMESHGUI_CreatePatternDlg.h"\r
+\r
+#include "SMESHGUI.h"\r
+#include "SMESHGUI_SpinBox.h"\r
+#include "SMESHGUI_PatternWidget.h"\r
+#include "SMESHGUI_Utils.h"\r
+#include "SMESHGUI_VTKUtils.h"\r
+#include "SMESHGUI_PatternUtils.h"\r
+#include "SMESHGUI_GEOMGenUtils.h"\r
+\r
+#include "SMESH_NumberFilter.hxx"\r
+\r
+#include "SUIT_ResourceMgr.h"\r
+#include "SUIT_Desktop.h"\r
+#include "SUIT_FileDlg.h"\r
+\r
+#include "SalomeApp_Study.h"\r
+#include "SalomeApp_DataOwner.h"\r
+#include "SalomeApp_SelectionMgr.h"\r
+#include "SalomeApp_Tools.h"\r
+\r
+#include "SALOMEDS_SObject.hxx"\r
+\r
+#include "SALOME_ListIO.hxx"\r
+#include "SVTK_ViewModel.h"\r
+#include "SVTK_ViewWindow.h"\r
+#include "SVTK_Selector.h"\r
+#include "SVTK_Selection.h"\r
+\r
+// OCCT Includes\r
+#include <TColStd_MapOfInteger.hxx>\r
+\r
+// QT Includes\r
+#include <qframe.h>\r
+#include <qlayout.h>\r
+#include <qlineedit.h>\r
+#include <qpushbutton.h>\r
+#include <qgroupbox.h>\r
+#include <qlabel.h>\r
+#include <qradiobutton.h>\r
+#include <qcheckbox.h>\r
+#include <qbuttongroup.h>\r
+#include <qmessagebox.h>\r
+#include <qapplication.h>\r
+\r
+#define SPACING 5\r
+#define MARGIN  10\r
+\r
+/*!\r
+ *  Class       : SMESHGUI_CreatePatternDlg\r
+ *  Description : Dialog to specify filters for VTK viewer\r
+ */\r
+\r
+//=======================================================================\r
+// function : SMESHGUI_CreatePatternDlg()\r
+// purpose  : Constructor\r
+//=======================================================================\r
+SMESHGUI_CreatePatternDlg::SMESHGUI_CreatePatternDlg( SMESHGUI*   theModule,\r
+                                                      const int   theType,\r
+                                                      const char* theName)\r
+     : QDialog( SMESH::GetDesktop( theModule ), theName, false,\r
+                WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu),\r
+     mySMESHGUI( theModule ),\r
+     mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ),\r
+     myViewWindow( SMESH::GetViewWindow( theModule ) ),\r
+     mySelector( myViewWindow->GetSelector() )\r
+{\r
+  setCaption(tr("CAPTION"));\r
+\r
+  QVBoxLayout* aDlgLay = new QVBoxLayout (this, MARGIN, SPACING);\r
+\r
+  QFrame* aMainFrame = createMainFrame  (this);\r
+  QFrame* aBtnFrame  = createButtonFrame(this);\r
+\r
+  aDlgLay->addWidget(aMainFrame);\r
+  aDlgLay->addWidget(aBtnFrame);\r
+\r
+  aDlgLay->setStretchFactor(aMainFrame, 1);\r
+\r
+  Init(theType);\r
+}\r
+\r
+//=======================================================================\r
+// function : createMainFrame()\r
+// purpose  : Create frame containing dialog's input fields\r
+//=======================================================================\r
+QFrame* SMESHGUI_CreatePatternDlg::createMainFrame (QWidget* theParent)\r
+{\r
+  QPixmap iconSlct     (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_SELECT")));\r
+  QPixmap icon2d       (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_PATTERN_2d")));\r
+  QPixmap icon3d       (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_PATTERN_3d")));\r
+  QPixmap iconSample2d (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_PATTERN_SAMPLE_2D")));\r
+\r
+  QGroupBox* aMainGrp = new QGroupBox(1, Qt::Horizontal, theParent);\r
+  aMainGrp->setFrameStyle(QFrame::NoFrame);\r
+  aMainGrp->setInsideMargin(0);\r
+\r
+  // Pattern type group\r
+\r
+  myTypeGrp = new QButtonGroup (1, Qt::Vertical, tr("PATTERN_TYPE"), aMainGrp);\r
+  mySwitch2d = new QRadioButton (myTypeGrp);\r
+  mySwitch3d = new QRadioButton (myTypeGrp);\r
+  mySwitch2d->setPixmap(icon2d);\r
+  mySwitch3d->setPixmap(icon3d);\r
+  myTypeGrp->insert(mySwitch2d, Type_2d);\r
+  myTypeGrp->insert(mySwitch3d, Type_3d);\r
+\r
+  QGroupBox* aPatternGrp = new QGroupBox(1, Qt::Horizontal, tr("PATTERN"), aMainGrp);\r
+\r
+  // Mesh and pattern name group\r
+\r
+  QGroupBox* aMeshGrp = new QGroupBox(1, Qt::Vertical, aPatternGrp);\r
+  aMeshGrp->setFrameStyle(QFrame::NoFrame);\r
+  aMeshGrp->setInsideMargin(0);\r
+\r
+  new QLabel(tr("MESH_OR_SUBMESH"), aMeshGrp);\r
+\r
+  QPushButton* aSelBtn = new QPushButton(aMeshGrp);\r
+  aSelBtn->setPixmap(iconSlct);\r
+  myMeshEdit = new QLineEdit(aMeshGrp);\r
+  myMeshEdit->setReadOnly(true);\r
+\r
+  QGroupBox* aPattGrp = new QGroupBox(1, Qt::Vertical, aPatternGrp);\r
+  aPattGrp->setFrameStyle(QFrame::NoFrame);\r
+  aPattGrp->setInsideMargin(0);\r
+\r
+  new QLabel(tr("PATTERN_NAME"), aPattGrp);\r
+  myName = new QLineEdit(aPattGrp);\r
+\r
+  // Picture 2d\r
+\r
+  myPicture2d = new SMESHGUI_PatternWidget(aPatternGrp),\r
+  myPicture2d->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding));\r
+\r
+  // Project check box\r
+\r
+  myProjectChk = new QCheckBox(tr("PROJECT"), aPatternGrp);\r
+\r
+  // Connect signals and slots\r
+\r
+  connect(myTypeGrp,    SIGNAL(clicked(int) ), SLOT(onTypeChanged(int)));\r
+  connect(myProjectChk, SIGNAL(toggled(bool)), SLOT(onProject(bool)   ));\r
+  connect(aSelBtn,      SIGNAL(clicked()      ), SLOT(onSelBtnClicked()));\r
+\r
+  return aMainGrp;\r
+}\r
+\r
+//=======================================================================\r
+// function : createButtonFrame()\r
+// purpose  : Create frame containing buttons\r
+//=======================================================================\r
+QFrame* SMESHGUI_CreatePatternDlg::createButtonFrame (QWidget* theParent)\r
+{\r
+  QFrame* aFrame = new QFrame(theParent);\r
+  aFrame->setFrameStyle(QFrame::Box | QFrame::Sunken);\r
+\r
+  myOkBtn    = new QPushButton(tr("SMESH_BUT_OK"    ), aFrame);\r
+  mySaveBtn  = new QPushButton(tr("SAVE"            ), aFrame);\r
+  myCloseBtn = new QPushButton(tr("SMESH_BUT_CANCEL"), aFrame);\r
+\r
+  QSpacerItem* aSpacer = new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum);\r
+\r
+  QHBoxLayout* aLay = new QHBoxLayout(aFrame, MARGIN, SPACING);\r
+\r
+  aLay->addWidget(myOkBtn);\r
+  aLay->addWidget(mySaveBtn);\r
+  aLay->addItem(aSpacer);\r
+  aLay->addWidget(myCloseBtn);\r
+\r
+  connect(myOkBtn,    SIGNAL(clicked()), SLOT(onOk()));\r
+  connect(myCloseBtn, SIGNAL(clicked()), SLOT(onClose()));\r
+  connect(mySaveBtn, SIGNAL(clicked()), SLOT(onSave()));\r
+\r
+  return aFrame;\r
+}\r
+\r
+//=======================================================================\r
+// function : ~SMESHGUI_CreatePatternDlg()\r
+// purpose  : Destructor\r
+//=======================================================================\r
+SMESHGUI_CreatePatternDlg::~SMESHGUI_CreatePatternDlg()\r
+{\r
+  // no need to delete child widgets, Qt does it all for us\r
+}\r
+\r
+//=======================================================================\r
+// function : onProject()\r
+// purpose  : SLOT. Called when state of "Project nodes on ther face"\r
+//            checkbox is changed\r
+//=======================================================================\r
+void SMESHGUI_CreatePatternDlg::onProject (bool)\r
+{\r
+  loadFromObject(false);\r
+  displayPreview();\r
+}\r
+\r
+//=======================================================================\r
+// function : Init()\r
+// purpose  : Init dialog fields, connect signals and slots, show dialog\r
+//=======================================================================\r
+void SMESHGUI_CreatePatternDlg::Init( const int theType )\r
+{\r
+  myIsLoaded     = false;\r
+  myType         = -1;\r
+  myNbPoints     = -1;\r
+  mySubMesh      = SMESH::SMESH_subMesh::_nil();\r
+  myMesh         = SMESH::SMESH_Mesh::_nil();\r
+  myGeomObj      = GEOM::GEOM_Object::_nil();\r
+  myPattern      = SMESH::SMESH_Pattern::_nil();\r
+\r
+  erasePreview();\r
+\r
+  mySMESHGUI->SetActiveDialogBox((QDialog*)this);\r
+\r
+  // selection and SMESHGUI\r
+  connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), SLOT(onSelectionDone()));\r
+  connect(mySMESHGUI, SIGNAL(SignalDeactivateActiveDialog()), SLOT(onDeactivate()));\r
+  connect(mySMESHGUI, SIGNAL(SignalCloseAllDialogs()), SLOT(onClose()));\r
+\r
+  mySwitch2d->setEnabled(theType == Type_2d);\r
+  mySwitch3d->setEnabled(theType == Type_3d);\r
+\r
+  if (theType == Type_2d)\r
+    myProjectChk->show();\r
+  else\r
+    myProjectChk->hide();\r
+\r
+  myTypeGrp->setButton(theType);\r
+  onTypeChanged(theType);\r
+\r
+  myName->setText(getDefaultName());\r
+  myMeshEdit->setText("");\r
+\r
+  setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding));\r
+  qApp->processEvents();\r
+  updateGeometry();\r
+  myPicture2d->updateGeometry();\r
+  adjustSize();\r
+  resize(minimumSize());\r
+\r
+  activateSelection();\r
+  onSelectionDone();\r
+\r
+  int x, y;\r
+  mySMESHGUI->DefineDlgPosition(this, x, y);\r
+  this->move(x, y);\r
+  this->show();\r
+}\r
+\r
+//=======================================================================\r
+// function : SetMesh()\r
+// purpose  : Set mesh to dialog\r
+//=======================================================================\r
+void SMESHGUI_CreatePatternDlg::SetMesh (SMESH::SMESH_Mesh_ptr thePtr)\r
+{\r
+  myMesh = SMESH::SMESH_Mesh::_duplicate(thePtr);\r
+  mySubMesh = SMESH::SMESH_subMesh::_nil();\r
+\r
+  bool isValidMesh = false;\r
+  if (!myMesh->_is_nil())\r
+  {\r
+    _PTR(SObject) aSobj = SMESH::FindSObject(myMesh.in());\r
+    //Handle(SALOME_InteractiveObject) anIObj =\r
+    //  new SALOME_InteractiveObject(aSobj->GetID().c_str(), "SMESH");\r
+    SUIT_DataOwnerPtr anIObj (new SalomeApp_DataOwner(aSobj->GetID().c_str()));\r
+\r
+    isValidMesh = mySelectionMgr->isOk(anIObj);\r
+  }\r
+\r
+  if (isValidMesh) {\r
+    _PTR(SObject) aSO = SMESH::FindSObject(myMesh.in());\r
+    myMeshEdit->setText(aSO->GetName().c_str());\r
+    myGeomObj = SMESH::GetGeom(aSO);\r
+  } else {\r
+    myMeshEdit->setText("");\r
+    myGeomObj = GEOM::GEOM_Object::_nil();\r
+  }\r
+\r
+  if (myType == Type_2d) {\r
+    loadFromObject(false);\r
+    displayPreview();\r
+  }\r
+}\r
+\r
+//=======================================================================\r
+// function : isValid()\r
+// purpose  : Verify validity of entry data\r
+//=======================================================================\r
+bool SMESHGUI_CreatePatternDlg::isValid()\r
+{\r
+  if (myGeomObj->_is_nil()) {\r
+    QMessageBox::information(SMESH::GetDesktop( mySMESHGUI ),\r
+                             tr("SMESH_INSUFFICIENT_DATA"),\r
+                             tr("SMESHGUI_INVALID_PARAMETERS"),\r
+                             QMessageBox::Ok);\r
+    return false;\r
+  }\r
+  else\r
+    return true;\r
+}\r
+\r
+//=======================================================================\r
+// function : getDefaultName()\r
+// purpose  : Get default pattern name\r
+//=======================================================================\r
+QString SMESHGUI_CreatePatternDlg::getDefaultName() const\r
+{\r
+  return myType == Type_2d ? tr("DEFAULT_2D") : tr("DEFAULT_3D");\r
+}\r
+\r
+//=======================================================================\r
+// function : onSave()\r
+// purpose  : SLOT called when "Save" button pressed. Build pattern and\r
+//           save it to disk\r
+//=======================================================================\r
+void SMESHGUI_CreatePatternDlg::onSave()\r
+{\r
+  try {\r
+    if (!isValid())\r
+      return;\r
+\r
+    if (!myIsLoaded)\r
+      loadFromObject(true);\r
+\r
+    // Load pattern from object\r
+    if (!myIsLoaded)\r
+      return;\r
+\r
+    ///////////////////////////////////////////////////////\r
+    SUIT_FileDlg* aDlg = new SUIT_FileDlg (this, false);\r
+    aDlg->setCaption(tr("SAVE_PATTERN"));\r
+    aDlg->setMode(QFileDialog::AnyFile);\r
+    aDlg->setFilters(tr("PATTERN_FILT"));\r
+    if (myName->text() != "")\r
+      aDlg->setSelection(myName->text());\r
+\r
+    if (aDlg->exec() != Accepted)\r
+      return;\r
+\r
+    QString fName = aDlg->selectedFile();\r
+    if (fName.isEmpty())\r
+      return;\r
+\r
+    if (QFileInfo(fName).extension().isEmpty())\r
+      fName = autoExtension(fName);\r
+\r
+    fName = QDir::convertSeparators(fName);\r
+\r
+    QString aData (myPattern->GetString());\r
+    long aLen = aData.length();\r
+\r
+    QFile aFile (fName);\r
+    aFile.open(IO_WriteOnly);\r
+    long aWritten = aFile.writeBlock(aData, aLen);\r
+    aFile.close();\r
+\r
+    if (aWritten != aLen) {\r
+      QMessageBox::information(SMESH::GetDesktop( mySMESHGUI ), tr("SMESH_ERROR"),\r
+                               tr("ERROR_OF_SAVING"), QMessageBox::Ok);\r
+    } else {\r
+      //SUIT_Application::getDesktop()->setSelectionModes(ActorSelection);\r
+      myViewWindow->SetSelectionMode(ActorSelection);\r
+      disconnect(mySelectionMgr, 0, this, 0);\r
+      disconnect(mySMESHGUI, 0, this, 0);\r
+      mySMESHGUI->ResetState();\r
+      accept();\r
+      emit NewPattern();\r
+    }\r
+  } catch (const SALOME::SALOME_Exception& S_ex) {\r
+    SalomeApp_Tools::QtCatchCorbaException(S_ex);\r
+  } catch (...) {\r
+  }\r
+}\r
+\r
+//=======================================================================\r
+// function : GetPatternName()\r
+// purpose  : Get name of pattern\r
+//=======================================================================\r
+QString SMESHGUI_CreatePatternDlg::GetPatternName() const\r
+{\r
+  return myName->text();\r
+}\r
+\r
+//=======================================================================\r
+// function : GetPattern()\r
+// purpose  : Get result pattern\r
+//=======================================================================\r
+SMESH::SMESH_Pattern_ptr SMESHGUI_CreatePatternDlg::GetPattern()\r
+{\r
+  return myPattern.in();\r
+}\r
+\r
+//=======================================================================\r
+// function : onOk()\r
+// purpose  : SLOT called when "Ok" button pressed.\r
+//=======================================================================\r
+void SMESHGUI_CreatePatternDlg::onOk()\r
+{\r
+  try {\r
+    if (!isValid())\r
+      return;\r
+\r
+    if (!myIsLoaded)\r
+      loadFromObject(true);\r
+\r
+    // Load pattern from object\r
+    if (!myIsLoaded) {\r
+      return;\r
+    } else {\r
+      //SUIT_Application::getDesktop()->setSelectionModes(ActorSelection);\r
+      myViewWindow->SetSelectionMode(ActorSelection);\r
+      disconnect(mySelectionMgr, 0, this, 0);\r
+      disconnect(mySMESHGUI, 0, this, 0);\r
+      mySMESHGUI->ResetState();\r
+      accept();\r
+      emit NewPattern();\r
+    }\r
+  } catch (const SALOME::SALOME_Exception& S_ex) {\r
+    SalomeApp_Tools::QtCatchCorbaException(S_ex);\r
+  } catch (...) {\r
+  }\r
+}\r
+\r
+//=======================================================================\r
+// function : onClose()\r
+// purpose  : SLOT called when "Close" button pressed. Close dialog\r
+//=======================================================================\r
+void SMESHGUI_CreatePatternDlg::onClose()\r
+{\r
+  myViewWindow->SetSelectionMode(ActorSelection);\r
+  disconnect(mySelectionMgr, 0, this, 0);\r
+  disconnect(mySMESHGUI, 0, this, 0);\r
+  mySMESHGUI->ResetState();\r
+  reject();\r
+  emit Close();\r
+}\r
+\r
+//=======================================================================\r
+// function : loadFromObject()\r
+// purpose  : Load pattern from geom object corresponding to the mesh/submesh\r
+//=======================================================================\r
+bool SMESHGUI_CreatePatternDlg::loadFromObject (const bool theMess)\r
+{\r
+  try {\r
+    myIsLoaded = false;\r
+\r
+    if (myPattern->_is_nil())\r
+      myPattern = SMESH::GetPattern();\r
+\r
+    if (myMesh->_is_nil() && mySubMesh->_is_nil() || myGeomObj->_is_nil())\r
+      return false;\r
+\r
+    SMESH::SMESH_Mesh_ptr aMesh = mySubMesh->_is_nil() ? myMesh.in() : mySubMesh->GetFather();\r
+\r
+    myIsLoaded = myType == Type_2d\r
+      ? myPattern->LoadFromFace(aMesh, myGeomObj, myProjectChk->isChecked())\r
+      : myPattern->LoadFrom3DBlock(aMesh, myGeomObj);\r
+\r
+    if (!myIsLoaded && theMess) {\r
+      QString aMess;\r
+      SMESH::SMESH_Pattern::ErrorCode aCode = myPattern->GetErrorCode();\r
+\r
+      if      (aCode == SMESH::SMESH_Pattern::ERR_LOAD_EMPTY_SUBMESH  ) aMess = tr("ERR_LOAD_EMPTY_SUBMESH");\r
+      else if (aCode == SMESH::SMESH_Pattern::ERR_LOADF_NARROW_FACE   ) aMess = tr("ERR_LOADF_NARROW_FACE");\r
+      else if (aCode == SMESH::SMESH_Pattern::ERR_LOADF_CLOSED_FACE   ) aMess = tr("ERR_LOADF_CLOSED_FACE");\r
+      else if (aCode == SMESH::SMESH_Pattern::ERR_LOADV_BAD_SHAPE     ) aMess = tr("ERR_LOADV_BAD_SHAPE");\r
+      else if (aCode == SMESH::SMESH_Pattern::ERR_LOADV_COMPUTE_PARAMS) aMess = tr("ERR_LOADV_COMPUTE_PARAMS");\r
+      else                                                              aMess = tr("ERROR_OF_CREATION");\r
+\r
+      QMessageBox::information(SMESH::GetDesktop( mySMESHGUI ),\r
+                               tr("SMESH_ERROR"), aMess, QMessageBox::Ok);\r
+    }\r
+  } catch (const SALOME::SALOME_Exception& S_ex) {\r
+    SalomeApp_Tools::QtCatchCorbaException(S_ex);\r
+  }\r
+\r
+  return myIsLoaded;\r
+}\r
+\r
+//=======================================================================\r
+// function : onSelectionDone()\r
+// purpose  : SLOT called when selection changed\r
+//=======================================================================\r
+void SMESHGUI_CreatePatternDlg::onSelectionDone()\r
+{\r
+  try {\r
+    SALOME_ListIO aList;\r
+    mySelectionMgr->selectedObjects(aList, SVTK_Viewer::Type());\r
+    if (aList.Extent() != 1)\r
+      return;\r
+\r
+    // Get mesh or sub-mesh from selection\r
+    Handle(SALOME_InteractiveObject) anIO = aList.First();\r
+    SMESH::SMESH_Mesh_var aMesh = SMESH::IObjectToInterface<SMESH::SMESH_Mesh>(anIO);\r
+    SMESH::SMESH_subMesh_var aSubMesh = SMESH::IObjectToInterface<SMESH::SMESH_subMesh>(anIO);\r
+    if (aMesh->_is_nil() && aSubMesh->_is_nil())\r
+      return;\r
+\r
+    // Get geom object corresponding to the mesh\r
+    _PTR(SObject) aSO;\r
+    if (!aMesh->_is_nil())\r
+      aSO = SMESH::FindSObject(aMesh.in());\r
+    else\r
+      aSO = SMESH::FindSObject(aSubMesh.in());\r
+\r
+    GEOM::GEOM_Object_var aGeomObj = SMESH::GetGeom(aSO);\r
+    if (aGeomObj->_is_nil())\r
+      return;\r
+\r
+    myGeomObj = aGeomObj;\r
+\r
+    // init class fields\r
+    if (!aMesh->_is_nil()) {\r
+      myMesh = aMesh;\r
+      mySubMesh = SMESH::SMESH_subMesh::_nil();\r
+    } else {\r
+      mySubMesh = aSubMesh;\r
+      myMesh = SMESH::SMESH_Mesh::_nil();\r
+    }\r
+\r
+    QString aName;\r
+    SMESH::GetNameOfSelectedIObjects(mySelectionMgr, aName);\r
+    myMeshEdit->setText(aName);\r
+\r
+    if (myType == Type_2d) {\r
+      loadFromObject(true);\r
+      displayPreview();\r
+    }\r
+  } catch (...) {\r
+    myMesh = SMESH::SMESH_Mesh::_nil();\r
+    mySubMesh = SMESH::SMESH_subMesh::_nil();\r
+    myGeomObj = GEOM::GEOM_Object::_nil();\r
+    erasePreview();\r
+  }\r
+}\r
+\r
+//=======================================================================\r
+// function : onDeactivate()\r
+// purpose  : SLOT called when dialog must be deativated\r
+//=======================================================================\r
+void SMESHGUI_CreatePatternDlg::onDeactivate()\r
+{\r
+  disconnect(mySelectionMgr, 0, this, 0);\r
+  setEnabled(false);\r
+}\r
+\r
+//=======================================================================\r
+// function : enterEvent()\r
+// purpose  : Event filter\r
+//=======================================================================\r
+void SMESHGUI_CreatePatternDlg::enterEvent (QEvent*)\r
+{\r
+  mySMESHGUI->EmitSignalDeactivateDialog();\r
+  setEnabled(true);\r
+  activateSelection();\r
+  connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), SLOT(onSelectionDone()));\r
+}\r
+\r
+//=================================================================================\r
+// function : closeEvent()\r
+// purpose  : Close dialog box\r
+//=================================================================================\r
+void SMESHGUI_CreatePatternDlg::closeEvent (QCloseEvent*)\r
+{\r
+  onClose();\r
+}\r
+\r
+//=======================================================================\r
+// function : onSelBtnClicked()\r
+// purpose  : SLOT. Called when -> button clicked.\r
+//=======================================================================\r
+void SMESHGUI_CreatePatternDlg::onSelBtnClicked()\r
+{\r
+  onSelectionDone();\r
+}\r
+\r
+//================================================================\r
+// function : autoExtension()\r
+// purpose  : Append extension to the file name\r
+//================================================================\r
+QString SMESHGUI_CreatePatternDlg::autoExtension (const QString& theFileName) const\r
+{\r
+  QString anExt = theFileName.section('.', -1);\r
+  return anExt != "smp" && anExt != "SMP" ? theFileName + ".smp" : theFileName;\r
+}\r
+\r
+//=======================================================================\r
+// function : displayPreview()\r
+// purpose  : Display preview\r
+//=======================================================================\r
+void SMESHGUI_CreatePatternDlg::displayPreview()\r
+{\r
+  // Redisplay preview in dialog\r
+  try {\r
+    if (!myIsLoaded) {\r
+      erasePreview();\r
+    } else {\r
+      SMESH::point_array_var pnts = myPattern->GetPoints();\r
+      SMESH::long_array_var keyPoints = myPattern->GetKeyPoints();\r
+      SMESH::array_of_long_array_var elemPoints = myPattern->GetElementPoints(false);\r
+\r
+      if (pnts->length()       == 0 ||\r
+          keyPoints->length()  == 0 ||\r
+          elemPoints->length() == 0) {\r
+        myIsLoaded = false;\r
+        erasePreview();\r
+        return;\r
+      }\r
+\r
+      PointVector aPoints (pnts->length());\r
+      QValueVector<int> aKeyPoints (keyPoints->length());\r
+      ConnectivityVector anElemPoints (elemPoints->length());\r
+\r
+      for (int i = 0, n = pnts->length(); i < n; i++)\r
+        aPoints[ i ] = pnts[ i ];\r
+\r
+      for (int i2 = 0, n2 = keyPoints->length(); i2 < n2; i2++)\r
+        aKeyPoints[ i2 ] = keyPoints[ i2 ];\r
+\r
+      for (int i3 = 0, n3 = elemPoints->length(); i3 < n3; i3++) {\r
+        QValueVector<int> aVec (elemPoints[ i3 ].length());\r
+        for (int i4 = 0, n4 = elemPoints[ i3 ].length(); i4 < n4; i4++)\r
+          aVec[ i4 ] = elemPoints[ i3 ][ i4 ];\r
+\r
+        anElemPoints[ i3 ] = aVec;\r
+      }\r
+\r
+      myPicture2d->SetPoints(aPoints, aKeyPoints, anElemPoints);\r
+    }\r
+\r
+    return;\r
+\r
+  } catch (const SALOME::SALOME_Exception& S_ex) {\r
+    SalomeApp_Tools::QtCatchCorbaException(S_ex);\r
+  } catch (...) {\r
+  }\r
+  erasePreview();\r
+}\r
+\r
+//=======================================================================\r
+// function : erasePreview()\r
+// purpose  : Erase preview\r
+//=======================================================================\r
+void SMESHGUI_CreatePatternDlg::erasePreview()\r
+{\r
+  // Erase preview in 2D viewer\r
+  myPicture2d->SetPoints(PointVector(), QValueVector<int>(), ConnectivityVector());\r
+}\r
+\r
+//=======================================================================\r
+// function : activateSelection()\r
+// purpose  : Activate selection in accordance with current pattern type\r
+//=======================================================================\r
+void SMESHGUI_CreatePatternDlg::activateSelection()\r
+{\r
+  mySelectionMgr->clearFilters();\r
+  //SUIT_Application::getDesktop()->setSelectionModes(ActorSelection);\r
+  myViewWindow->SetSelectionMode(ActorSelection);\r
+\r
+  if (myType == Type_2d) {\r
+    mySelectionMgr->installFilter(new SMESH_NumberFilter\r
+      ("SMESH", TopAbs_SHAPE, -1, TopAbs_FACE));\r
+  } else {\r
+    TColStd_MapOfInteger aTypes;\r
+    aTypes.Add(TopAbs_SHELL);\r
+    aTypes.Add(TopAbs_SOLID);\r
+    mySelectionMgr->installFilter(new SMESH_NumberFilter\r
+      ("SMESH", TopAbs_FACE, 6, aTypes, GEOM::GEOM_Object::_nil(), true));\r
+  }\r
+}\r
+\r
+//=======================================================================\r
+// function : onTypeChanged()\r
+// purpose  : SLOT. Called when pattern type changed.\r
+//            Change dialog's look and feel\r
+//=======================================================================\r
+void SMESHGUI_CreatePatternDlg::onTypeChanged (int theType)\r
+{\r
+  if (myType == theType)\r
+    return;\r
+\r
+  myType = theType;\r
+\r
+  if (theType == Type_2d)\r
+    myPicture2d->show();\r
+  else\r
+    myPicture2d->hide();\r
+}\r
index 01abc7e4acbbabf2329d144c737ff252877b1467..b6305bd93c1f141ff69ab5fc6405a6422083ad6c 100644 (file)
@@ -52,7 +52,7 @@ class SMESHGUI_DeleteGroupDlg : public QDialog
   Q_OBJECT
 
 public:
-                          SMESHGUI_DeleteGroupDlg (SMESHGUI* theModule);
+                          SMESHGUI_DeleteGroupDlg( SMESHGUI* );
   virtual                 ~SMESHGUI_DeleteGroupDlg();
 
   void                    Init ();
index 16feafbc57a0c3eabfbccb78fbaa6e1cd527c800..3e5f9242a3981153f2009ff75c33707400f7791e 100644 (file)
@@ -115,7 +115,7 @@ SMESHGUI_EditHypothesesDlg::SMESHGUI_EditHypothesesDlg (SMESHGUI* theModule, con
     mySMESHGUI( theModule ),
     mySelectionMgr( SMESH::GetSelectionMgr( theModule ) )
 {
-    QPixmap image0 (SMESHGUI::resourceMgr()->loadPixmap("SMESH", tr("ICON_SELECT")));
+    QPixmap image0 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_SELECT")));
     if (!name)
       setName("SMESHGUI_EditHypothesesDlg");
     setCaption(tr("SMESH_EDIT_HYPOTHESES"));
index 46222594ed97e7242cc0c7d3c3bd6ad8bdbb440a..b4d4a70c7252f0e4faa532eb401dcb5572b8e38a 100644 (file)
@@ -101,11 +101,12 @@ SMESHGUI_ExtrusionAlongPathDlg::SMESHGUI_ExtrusionAlongPathDlg( SMESHGUI* theMod
      myViewWindow( SMESH::GetViewWindow( theModule ) ),
      mySelector( myViewWindow->GetSelector() )
 {
-  QPixmap edgeImage   (SMESHGUI::resourceMgr()->loadPixmap("SMESH", tr("ICON_DLG_EDGE")));
-  QPixmap faceImage   (SMESHGUI::resourceMgr()->loadPixmap("SMESH", tr("ICON_DLG_TRIANGLE")));
-  QPixmap selectImage (SMESHGUI::resourceMgr()->loadPixmap("SMESH", tr("ICON_SELECT")));
-  QPixmap addImage    (SMESHGUI::resourceMgr()->loadPixmap("SMESH", tr("ICON_APPEND")));
-  QPixmap removeImage (SMESHGUI::resourceMgr()->loadPixmap("SMESH", tr("ICON_REMOVE")));
+  SUIT_ResourceMgr* mgr = SMESH::GetResourceMgr( mySMESHGUI );
+  QPixmap edgeImage   ( mgr->loadPixmap("SMESH", tr("ICON_DLG_EDGE")));
+  QPixmap faceImage   ( mgr->loadPixmap("SMESH", tr("ICON_DLG_TRIANGLE")));
+  QPixmap selectImage ( mgr->loadPixmap("SMESH", tr("ICON_SELECT")));
+  QPixmap addImage    ( mgr->loadPixmap("SMESH", tr("ICON_APPEND")));
+  QPixmap removeImage ( mgr->loadPixmap("SMESH", tr("ICON_REMOVE")));
 
   myType = -1;
 
index 1a42cceba5de9754bbab06374356fe6d0a4bad30..4860baeef08822edc19346087fbc58336f50cc9d 100644 (file)
@@ -92,9 +92,9 @@ SMESHGUI_ExtrusionDlg::SMESHGUI_ExtrusionDlg (SMESHGUI* theModule,
      myViewWindow( SMESH::GetViewWindow( theModule ) ),
      mySelector( myViewWindow->GetSelector() )
 {
-  QPixmap image0 (SMESHGUI::resourceMgr()->loadPixmap("SMESH", tr("ICON_DLG_EDGE")));
-  QPixmap image1 (SMESHGUI::resourceMgr()->loadPixmap("SMESH", tr("ICON_DLG_TRIANGLE")));
-  QPixmap image2 (SMESHGUI::resourceMgr()->loadPixmap("SMESH", tr("ICON_SELECT")));
+  QPixmap image0 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_DLG_EDGE")));
+  QPixmap image1 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_DLG_TRIANGLE")));
+  QPixmap image2 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_SELECT")));
 
   resize(303, 185);
   setCaption(tr("EXTRUSION_ALONG_LINE"));
index bf2863b201db94f2dd90e7b37ab2d8584a09e2d5..b2e9627b8bc4e51151235c62f71d24cb9f8f2179 100755 (executable)
@@ -2190,7 +2190,7 @@ bool SMESHGUI_FilterDlg::createFilter (const int theType)
   aCriteria->length(n);
 
   long aPrecision = -1;
-  SUIT_ResourceMgr* mgr = SMESHGUI::resourceMgr();
+  SUIT_ResourceMgr* mgr = SMESH::GetResourceMgr( mySMESHGUI );
 
   if (mgr && mgr->hasValue("SMESH", "ControlsPrecision")) {
     QString aStr = mgr->stringValue("SMESH", "ControlsPrecision");
index 5ec1935cdeebf2f032b04c0842aa089ae04b2db1..2a86d827468eab72b721d81310a63304e02a56c5 100644 (file)
@@ -149,7 +149,7 @@ void SMESHGUI_GroupDlg::initDialog(bool create)
   myCreate = create;
   myCurrentLineEdit = 0;
 
-  QPixmap image0 (SMESHGUI::resourceMgr()->loadPixmap("SMESH", tr("ICON_SELECT")));
+  QPixmap image0 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_SELECT")));
 
   if (create)
     setCaption(tr("SMESH_CREATE_GROUP_TITLE"));
@@ -744,7 +744,7 @@ void SMESHGUI_GroupDlg::onObjectSelectionChanged()
 
       myElements->clear();
 
-      if (aNbSel == 0 ) {
+      if (aNbSel != 1 ) {
         myGroup = SMESH::SMESH_Group::_nil();
         myMesh = SMESH::SMESH_Mesh::_nil();
         myIsBusy = false;
@@ -805,7 +805,7 @@ void SMESHGUI_GroupDlg::onObjectSelectionChanged()
       return;
 
     } else if (myCurrentLineEdit == myGeomGroupLine) {
-      if (aNbSel == 0) {
+      if (aNbSel != 1) {
         myGeomGroup = GEOM::GEOM_Object::_nil();
         myIsBusy = false;
         return;
index 04a03263ad03f5c6b449f021ea6043c79390e320..7c15603ed475c5a8a4d71d09d970e1891f1e0261 100644 (file)
@@ -29,6 +29,7 @@
 
 #include "SMESHGUI.h"
 #include "SMESHGUI_Utils.h"
+#include "SMESHGUI_VTKUtils.h"
 
 #include "SMESH_TypeFilter.hxx"
 
@@ -37,6 +38,8 @@
 
 #include "SalomeApp_SelectionMgr.h"
 #include "SVTK_Selection.h"
+#include "SVTK_ViewWindow.h"
+#include "SVTK_Selector.h"
 #include "SALOME_ListIO.hxx"
 
 // QT Includes
 // name    : SMESHGUI_GroupOpDlg::SMESHGUI_GroupOpDlg
 // Purpose : Constructor
 //=======================================================================
-SMESHGUI_GroupOpDlg::SMESHGUI_GroupOpDlg (QWidget*                theParent,
-                                          SalomeApp_SelectionMgr* theSelection,
-                                          const int               theMode)
-     : QDialog(theParent, "SMESHGUI_GroupOpDlg", false,
-               WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu)
+SMESHGUI_GroupOpDlg::SMESHGUI_GroupOpDlg( SMESHGUI* theModule, const int theMode )
+     : QDialog( SMESH::GetDesktop( theModule ), "SMESHGUI_GroupOpDlg", false,
+                WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu ),
+     mySMESHGUI( theModule ),
+     mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ),
+     myViewWindow( SMESH::GetViewWindow( theModule ) ),
+     mySelector( myViewWindow->GetSelector() )
 {
   myMode = theMode;
 
@@ -83,7 +88,7 @@ SMESHGUI_GroupOpDlg::SMESHGUI_GroupOpDlg (QWidget*                theParent,
 
   aDlgLay->setStretchFactor(aMainFrame, 1);
 
-  Init(theSelection);
+  Init();
 }
 
 //=======================================================================
@@ -115,7 +120,7 @@ QFrame* SMESHGUI_GroupOpDlg::createMainFrame (QWidget* theParent)
   myEdit1->setReadOnly(true);
   myEdit2->setReadOnly(true);
 
-  QPixmap aPix (SMESHGUI::resourceMgr()->loadPixmap("SMESH", tr("ICON_SELECT")));
+  QPixmap aPix (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_SELECT")));
   myBtn1->setPixmap(aPix);
   myBtn2->setPixmap(aPix);
 
@@ -164,11 +169,9 @@ SMESHGUI_GroupOpDlg::~SMESHGUI_GroupOpDlg()
 // name    : SMESHGUI_GroupOpDlg::Init
 // Purpose : Init dialog fields, connect signals and slots, show dialog
 //=======================================================================
-void SMESHGUI_GroupOpDlg::Init (SalomeApp_SelectionMgr* theSelection)
+void SMESHGUI_GroupOpDlg::Init()
 {
-  mySelectionMgr = theSelection;
-  SMESHGUI* aSMESHGUI = SMESHGUI::GetSMESHGUI();
-  aSMESHGUI->SetActiveDialogBox((QDialog*)this);
+  mySMESHGUI->SetActiveDialogBox((QDialog*)this);
   myFocusWg = myEdit1;
 
   myGroup1 = SMESH::SMESH_GroupBase::_nil();
@@ -176,23 +179,19 @@ void SMESHGUI_GroupOpDlg::Init (SalomeApp_SelectionMgr* theSelection)
 
   // selection and SMESHGUI
   connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), SLOT(onSelectionDone()));
-  connect(aSMESHGUI, SIGNAL(SignalDeactivateActiveDialog()), SLOT(onDeactivate()));
-  connect(aSMESHGUI, SIGNAL(SignalCloseAllDialogs()), SLOT(ClickOnClose()));
+  connect(mySMESHGUI, SIGNAL(SignalDeactivateActiveDialog()), SLOT(onDeactivate()));
+  connect(mySMESHGUI, SIGNAL(SignalCloseAllDialogs()), SLOT(ClickOnClose()));
 
   connect(myBtn1, SIGNAL(clicked()), this, SLOT(onFocusChanged()));
   connect(myBtn2, SIGNAL(clicked()), this, SLOT(onFocusChanged()));
 
   int x, y;
-  aSMESHGUI->DefineDlgPosition(this, x, y);
+  mySMESHGUI->DefineDlgPosition(this, x, y);
   this->move(x, y);
   this->show();
 
   // set selection mode
-#ifdef NEW_GUI
-  mySelectionMgr->setSelectionModes(ActorSelection, true);
-#else
-  mySelectionMgr->setSelectionModes(ActorSelection);
-#endif
+  myViewWindow->SetSelectionMode(ActorSelection);
   mySelectionMgr->installFilter(new SMESH_TypeFilter (GROUP));
 
   return;
@@ -247,7 +246,7 @@ bool SMESHGUI_GroupOpDlg::isValid()
 //=======================================================================
 bool SMESHGUI_GroupOpDlg::onApply()
 {
-  if (!isValid() || SMESHGUI::GetSMESHGUI()->isActiveStudyLocked())
+  if (!isValid() || mySMESHGUI->isActiveStudyLocked())
     return false;
 
   SMESH::SMESH_Mesh_ptr aMesh = myGroup1->GetMesh();
@@ -259,7 +258,7 @@ bool SMESHGUI_GroupOpDlg::onApply()
   else aNewGrp = aMesh->CutGroups(myGroup1, myGroup2, aName.latin1());
 
   if (!aNewGrp->_is_nil()) {
-    SMESHGUI::GetSMESHGUI()->updateObjBrowser(true);
+    mySMESHGUI->updateObjBrowser(true);
     reset();
     return true;
   } else {
@@ -285,10 +284,10 @@ void SMESHGUI_GroupOpDlg::onOk()
 //=======================================================================
 void SMESHGUI_GroupOpDlg::onClose()
 {
-  mySelectionMgr->setSelectionModes(ActorSelection);
+  myViewWindow->SetSelectionMode(ActorSelection);
   disconnect(mySelectionMgr, 0, this, 0);
-  disconnect(SMESHGUI::GetSMESHGUI(), 0, this, 0);
-  SMESHGUI::GetSMESHGUI()->ResetState();
+  disconnect(mySMESHGUI, 0, this, 0);
+  mySMESHGUI->ResetState();
   mySelectionMgr->clearFilters();
   reject();
 }
@@ -342,13 +341,9 @@ void SMESHGUI_GroupOpDlg::onDeactivate()
 //=======================================================================
 void SMESHGUI_GroupOpDlg::enterEvent (QEvent*)
 {
-  SMESHGUI::GetSMESHGUI()->EmitSignalDeactivateDialog();
+  mySMESHGUI->EmitSignalDeactivateDialog();
   setEnabled(true);
-#ifdef NEW_GUI
-  mySelectionMgr->setSelectionModes(ActorSelection, true);
-#else
-  mySelectionMgr->setSelectionModes(ActorSelection);
-#endif
+  myViewWindow->SetSelectionMode(ActorSelection);
   mySelectionMgr->installFilter(new SMESH_TypeFilter (GROUP));
 }
 
index d05201390a54448ad371550166af24d1d2207c70..e04b02fde0fa88cf429a84fc478d2d1bb58d0399 100644 (file)
@@ -38,6 +38,9 @@ class QFrame;
 class QPushButton;
 class SalomeApp_SelectionMgr;
 class QLineEdit;
+class SMESHGUI;
+class SVTK_ViewWindow;
+class SVTK_Selector;
 
 /*
   Class       : SMESHGUI_GroupOpDlg
@@ -52,10 +55,10 @@ public:
   enum { UNION, INTERSECT, CUT };
     
 public:
-                            SMESHGUI_GroupOpDlg( QWidget*, SalomeApp_SelectionMgr*, const int );
+                            SMESHGUI_GroupOpDlg( SMESHGUI*, const int );
   virtual                   ~SMESHGUI_GroupOpDlg();
 
-  void                      Init( SalomeApp_SelectionMgr* ) ;
+  void                      Init();
   
 private:
 
@@ -91,8 +94,11 @@ private:
   QPushButton*              myBtn1;
   QPushButton*              myBtn2;
   
+  SMESHGUI*                 mySMESHGUI;
   SalomeApp_SelectionMgr*   mySelectionMgr;
   int                       myMode;
+  SVTK_ViewWindow*          myViewWindow;
+  SVTK_Selector*            mySelector;
   
   QLineEdit*                myFocusWg;
   
index ce686c62ad9a615fc61fdc959cfd3042edb19037..388409a8ca01622b9a8eabb76d76bec14fe4d830 100644 (file)
@@ -99,7 +99,7 @@ SMESHGUI_InitMeshDlg::SMESHGUI_InitMeshDlg (SMESHGUI* theModule, const char* nam
     mySMESHGUI( theModule ),
     mySelectionMgr( SMESH::GetSelectionMgr( theModule ) )
 {
-    QPixmap image0 (SMESHGUI::resourceMgr()->loadPixmap("SMESH", tr("ICON_SELECT")));
+    QPixmap image0 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_SELECT")));
     if (!name)
       setName("SMESHGUI_InitMeshDlg");
 
index 2a36a93afc960ff2c31a9a8c3ca136788843776c..7ad8ccbe4c1f9bae6709c3e479afbe2ddad5d021 100644 (file)
@@ -83,8 +83,8 @@ SMESHGUI_MergeNodesDlg::SMESHGUI_MergeNodesDlg( SMESHGUI* theModule, const char*
      myViewWindow( SMESH::GetViewWindow( theModule ) ),
      mySelector( myViewWindow->GetSelector() )
 {
-  QPixmap image0 (SMESHGUI::resourceMgr()->loadPixmap("SMESH", tr("ICON_SMESH_MERGE_NODES")));
-  QPixmap image1 (SMESHGUI::resourceMgr()->loadPixmap("SMESH", tr("ICON_SELECT")));
+  QPixmap image0 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_SMESH_MERGE_NODES")));
+  QPixmap image1 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_SELECT")));
 
   if (!name)
     setName("SMESHGUI_MergeNodesDlg");
@@ -247,7 +247,6 @@ SMESHGUI_MergeNodesDlg::SMESHGUI_MergeNodesDlg( SMESHGUI* theModule, const char*
 
   myActor = 0;
 
-  mySMESHGUI = SMESHGUI::GetSMESHGUI();
   mySMESHGUI->SetActiveDialogBox((QDialog*)this);
 
   myMeshOrSubMeshFilter = new SMESH_TypeFilter (MESHorSUBMESH);
index cd16d80bd0e1129994f51c68388fcc3eb17dbd67..3584bae23b4e0ac1f2718af76da2be7b7da2c499 100644 (file)
@@ -86,7 +86,7 @@ SMESHGUI_MeshInfosDlg::SMESHGUI_MeshInfosDlg (SMESHGUI* theModule,
   aTopLayout->setSpacing(6);  aTopLayout->setMargin(11);
 
   // select button & label
-  QPixmap image0(SMESHGUI::resourceMgr()->loadPixmap("SMESH",tr("ICON_SELECT")));
+  QPixmap image0(SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH",tr("ICON_SELECT")));
   mySelectBtn = new QPushButton(this, "mySelectBtn");
   mySelectBtn->setPixmap(image0);
   mySelectBtn->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed));
index 2093f8ae1c5db39e0d5eb11670a7cdc4e7cdea67..238f2277cdfa2e5cba139a95cbda937ec81521eb 100755 (executable)
@@ -136,13 +136,14 @@ SMESHGUI_MeshPatternDlg::SMESHGUI_MeshPatternDlg( SMESHGUI*   theModule,
 //=======================================================================
 QFrame* SMESHGUI_MeshPatternDlg::createMainFrame (QWidget* theParent)
 {
-  QPixmap iconSlct (SMESHGUI::resourceMgr()->loadPixmap("SMESH", tr("ICON_SELECT")));
-  QPixmap icon2d   (SMESHGUI::resourceMgr()->loadPixmap("SMESH", tr("ICON_PATTERN_2d")));
-  QPixmap icon3d   (SMESHGUI::resourceMgr()->loadPixmap("SMESH", tr("ICON_PATTERN_3d")));
-  QPixmap iconOpen (SMESHGUI::resourceMgr()->loadPixmap("SMESH", tr("ICON_FILE_OPEN")));
+  SUIT_ResourceMgr* mgr = SMESH::GetResourceMgr( mySMESHGUI );
+  QPixmap iconSlct ( mgr->loadPixmap("SMESH", tr("ICON_SELECT")));
+  QPixmap icon2d   ( mgr->loadPixmap("SMESH", tr("ICON_PATTERN_2d")));
+  QPixmap icon3d   ( mgr->loadPixmap("SMESH", tr("ICON_PATTERN_3d")));
+  QPixmap iconOpen ( mgr->loadPixmap("SMESH", tr("ICON_FILE_OPEN")));
 
-  QPixmap iconSample2d (SMESHGUI::resourceMgr()->loadPixmap("SMESH", tr("ICON_PATTERN_SAMPLE_2D")));
-  QPixmap iconSample3d (SMESHGUI::resourceMgr()->loadPixmap("SMESH", tr("ICON_PATTERN_SAMPLE_3D")));
+  QPixmap iconSample2d ( mgr->loadPixmap("SMESH", tr("ICON_PATTERN_SAMPLE_2D")));
+  QPixmap iconSample3d ( mgr->loadPixmap("SMESH", tr("ICON_PATTERN_SAMPLE_3D")));
 
   QGroupBox* aMainGrp = new QGroupBox (1, Qt::Horizontal, theParent);
   aMainGrp->setFrameStyle(QFrame::NoFrame);
@@ -413,7 +414,7 @@ bool SMESHGUI_MeshPatternDlg::onApply()
     bool toCreatePolyedrs = myCreatePolyedrsChk->isChecked();
     if ( myPattern->MakeMesh( myMesh, toCreatePolygons, toCreatePolyedrs ) ) {
       mySelectionMgr->clearSelected();
-      SUIT_ResourceMgr* mgr = SMESHGUI::resourceMgr();
+      SUIT_ResourceMgr* mgr = SMESH::GetResourceMgr( mySMESHGUI );
       bool autoUpdate = false;
       if (mgr && mgr->stringValue("SMESH", "AutomaticUpdate").compare("true") == 0)
         autoUpdate = true;
index b719ffeab347965cf466f91cbe7ab57c69b28d55..12ad1b684ca5377ac5cddf34125814160fe21fac 100644 (file)
@@ -153,8 +153,8 @@ QFrame* SMESHGUI_MoveNodesDlg::createMainFrame (QWidget* theParent)
 {
   QFrame* aFrame = new QFrame(theParent);
 
-  QPixmap iconMoveNode (SMESHGUI::resourceMgr()->loadPixmap("SMESH", tr("ICON_DLG_MOVE_NODE")));
-  QPixmap iconSelect   (SMESHGUI::resourceMgr()->loadPixmap("SMESH", tr("ICON_SELECT")));
+  QPixmap iconMoveNode (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_DLG_MOVE_NODE")));
+  QPixmap iconSelect   (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_SELECT")));
 
   QButtonGroup* aPixGrp = new QButtonGroup(1, Qt::Vertical, tr("MESH_NODE"), aFrame);
   aPixGrp->setExclusive(TRUE);
index f1d9400615dfe7b59ddc690addfe87e30b4f009d..d2fd9fefb96a4ff2f7bcd8d48d3999bdb35fd434 100755 (executable)
@@ -141,7 +141,7 @@ QFrame* SMESHGUI_MultiEditDlg::createMainFrame (QWidget* theParent, const bool t
   aMainGrp->setFrameStyle(QFrame::NoFrame);
   aMainGrp->setInsideMargin(0);
 
-  QPixmap aPix (SMESHGUI::resourceMgr()->loadPixmap("SMESH", tr("ICON_SELECT")));
+  QPixmap aPix (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_SELECT")));
 
   // "Selected cells" group
   mySelGrp = new QGroupBox(1, Qt::Horizontal,  aMainGrp);
index 69801bb651cb5085d8b2e7fdd6233523c1078568..3237ae7939419f384f29ff694dbafd8cc058243b 100644 (file)
@@ -237,7 +237,7 @@ SMESHGUI_NodesDlg::SMESHGUI_NodesDlg (SMESHGUI* theModule,
 {
   mySimulation = new SMESH::TNodeSimulation(myViewWindow);
 
-  QPixmap image0 (SMESHGUI::resourceMgr()->loadPixmap("SMESH", tr("ICON_DLG_NODE")));
+  QPixmap image0 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_DLG_NODE")));
   if (!name)
     setName("SMESHGUI_NodesDlg");
   resize(303, 185);
index 5024a235edc4b8fc712a5a1947610112e5623582..62a15b8f4372534b273255fe54a6b6817f69160b 100755 (executable)
@@ -29,7 +29,9 @@
 
 #include "SMESHGUI.h"
 #include "SMESHGUI_VTKUtils.h"
+#include "SMESHGUI_Utils.h"
 
+#include "SUIT_Desktop.h"
 #include "SUIT_ResourceMgr.h"
 
 #include <qgroupbox.h>
 // name    : SMESHGUI_PrecisionDlg::SMESHGUI_PrecisionDlg
 // Purpose : Constructor
 //=======================================================================
-SMESHGUI_PrecisionDlg::SMESHGUI_PrecisionDlg (QWidget* theParent)
-     : QDialog(theParent, "SMESHGUI_PrecisionDlg", true,
-               WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu)
+SMESHGUI_PrecisionDlg::SMESHGUI_PrecisionDlg ( SMESHGUI* theModule )
+     : QDialog( SMESH::GetDesktop( theModule ), "SMESHGUI_PrecisionDlg", true,
+                WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu ),
+     mySMESHGUI( theModule )
 {
   setCaption(tr("CAPTION"));
 
@@ -129,7 +132,7 @@ void SMESHGUI_PrecisionDlg::Init()
 {
   bool isOk = false;
   int aVal = DEFAULT_VAL;
-  SUIT_ResourceMgr* mgr = SMESHGUI::resourceMgr();
+  SUIT_ResourceMgr* mgr = SMESH::GetResourceMgr( mySMESHGUI );
   if (mgr && mgr->hasValue("SMESH", "ControlsPrecision")) {
     QString aStr = mgr->stringValue("SMESH", "ControlsPrecision");
     aVal = aStr.toInt(&isOk);
@@ -140,9 +143,8 @@ void SMESHGUI_PrecisionDlg::Init()
 
   onNotUse();
 
-  SMESHGUI* aSMESHGUI = SMESHGUI::GetSMESHGUI();
-  aSMESHGUI->SetActiveDialogBox((QDialog*)this);
-  connect(aSMESHGUI, SIGNAL(SignalCloseAllDialogs()), SLOT(onClose()));
+  mySMESHGUI->SetActiveDialogBox((QDialog*)this);
+  connect(mySMESHGUI, SIGNAL(SignalCloseAllDialogs()), SLOT(onClose()));
 }
 
 //=======================================================================
@@ -151,7 +153,7 @@ void SMESHGUI_PrecisionDlg::Init()
 //=======================================================================
 void SMESHGUI_PrecisionDlg::onOk()
 {
-  SUIT_ResourceMgr* mgr = SMESHGUI::resourceMgr();
+  SUIT_ResourceMgr* mgr = SMESH::GetResourceMgr( mySMESHGUI );
   if (myNotUseChk->isChecked()) {
     if (mgr) {
       mgr->remove("SMESH", "ControlsPrecision");
@@ -166,8 +168,8 @@ void SMESHGUI_PrecisionDlg::onOk()
     SMESH::SetControlsPrecision(aVal);
   }
 
-  disconnect(SMESHGUI::GetSMESHGUI(), 0, this, 0);
-  SMESHGUI::GetSMESHGUI()->ResetState() ;
+  disconnect(mySMESHGUI, 0, this, 0);
+  mySMESHGUI->ResetState() ;
   accept();
 }
 
@@ -177,7 +179,7 @@ void SMESHGUI_PrecisionDlg::onOk()
 //=======================================================================
 void SMESHGUI_PrecisionDlg::onClose()
 {
-  disconnect(SMESHGUI::GetSMESHGUI(), 0, this, 0);
+  disconnect( mySMESHGUI, 0, this, 0);
   reject();
 }
 
index c37809963d30ceb3d70ea0eb6141b890c83337cf..976db3091f589b3a7a2e9d1fcb9c2ee74f022abb 100755 (executable)
@@ -35,6 +35,7 @@ class QSpinBox;
 class QPushButton;
 class QCheckBox;
 class QFrame;
+class SMESHGUI;
 
 /*
   Class       : SMESHGUI_PrecisionDlg
@@ -46,7 +47,7 @@ class SMESHGUI_PrecisionDlg : public QDialog
   Q_OBJECT
 
 public:
-                            SMESHGUI_PrecisionDlg( QWidget* parent );
+                            SMESHGUI_PrecisionDlg( SMESHGUI* );
 
   virtual                   ~SMESHGUI_PrecisionDlg();
 
@@ -65,7 +66,7 @@ private:
   void                      closeEvent( QCloseEvent* );
  
 private:
-
+  SMESHGUI*                 mySMESHGUI;
   QSpinBox*                 mySpinBox;
   QPushButton*              myOKBtn;
   QPushButton*              myCancelBtn;
index abe998f850bbe163ed578df544f8ebe263ba44e0..d51137871398248eb36d975d6c7dfcff53da26dc 100644 (file)
@@ -28,6 +28,7 @@
 
 #include "SMESHGUI_Preferences_ColorDlg.h"
 #include "SMESHGUI.h"
+#include "SMESHGUI_Utils.h"
 
 #include "utilities.h"
 
@@ -44,6 +45,8 @@
 #include <qspinbox.h>
 #include <qcolor.h>
 
+#include "SUIT_Desktop.h"
+
 using namespace std;
 
 //=================================================================================
@@ -53,10 +56,10 @@ using namespace std;
 //            The dialog will by default be modeless, unless you
 //            set'modal' to TRUE to construct a modal dialog.
 //=================================================================================
-SMESHGUI_Preferences_ColorDlg::SMESHGUI_Preferences_ColorDlg (QWidget* parent,
-                                                              const char* name)
-     : QDialog(parent, name, true, WStyle_Customize |
-               WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu)
+SMESHGUI_Preferences_ColorDlg::SMESHGUI_Preferences_ColorDlg( SMESHGUI* theModule, const char* name)
+     : QDialog( SMESH::GetDesktop( theModule ), name, true, WStyle_Customize |
+                WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu ),
+    mySMESHGUI( theModule )
 {
     if (!name)
        setName("SMESHGUI_Preferences_ColorDlg");
@@ -182,7 +185,6 @@ SMESHGUI_Preferences_ColorDlg::~SMESHGUI_Preferences_ColorDlg()
 //=================================================================================
 void SMESHGUI_Preferences_ColorDlg::Init()
 {
-  mySMESHGUI = SMESHGUI::GetSMESHGUI();
   mySMESHGUI->SetActiveDialogBox((QDialog*)this);
 
   /* signals and slots connections */
index 5ad2c5403273fffd590ce191da4934519269424b..43702b2acfcf5289bab0e8700d0d7ad30a180bad 100644 (file)
@@ -53,7 +53,7 @@ class SMESHGUI_Preferences_ColorDlg : public QDialog
     Q_OBJECT
 
 public:
-    SMESHGUI_Preferences_ColorDlg( QWidget* parent = 0, const char* name = 0 );
+    SMESHGUI_Preferences_ColorDlg( SMESHGUI*, const char* name = 0 );
     ~SMESHGUI_Preferences_ColorDlg();
 
     void   SetColor(int type, QColor color);
index 850194b22d767275bd1bfa57f47becd5ce5cc4a1..2a9ad020bf1cd1eb1ae748f075cf684b57455aff 100644 (file)
 
 #include "SMESHGUI.h"
 #include "SMESHGUI_VTKUtils.h"
+#include "SMESHGUI_Utils.h"
 
 #include "SMESH_Actor.h"
 
+#include "SUIT_Desktop.h"
 #include "SUIT_ResourceMgr.h"
 
 #include "SalomeApp_SelectionMgr.h"
@@ -83,11 +85,10 @@ SMESHGUI_Preferences_ScalarBarDlg* SMESHGUI_Preferences_ScalarBarDlg::myDlg = 0;
  *  Gets the only instance of "Scalar Bar Properties" dialog box
  */
 //=================================================================================================
-void SMESHGUI_Preferences_ScalarBarDlg::ScalarBarProperties (QWidget* parent,
-                                                             SalomeApp_SelectionMgr* Sel)
+void SMESHGUI_Preferences_ScalarBarDlg::ScalarBarProperties( SMESHGUI* theModule )
 {
   if (!myDlg) {
-    myDlg = new SMESHGUI_Preferences_ScalarBarDlg (parent, Sel, false);
+    myDlg = new SMESHGUI_Preferences_ScalarBarDlg( theModule, false);
     myDlg->show();
   } else {
     myDlg->show();
@@ -104,10 +105,10 @@ void SMESHGUI_Preferences_ScalarBarDlg::ScalarBarProperties (QWidget* parent,
  *  Opens "Scalar Bar Preferences" dialog box
  */
 //=================================================================================================
-void SMESHGUI_Preferences_ScalarBarDlg::ScalarBarPreferences (QWidget* parent)
+void SMESHGUI_Preferences_ScalarBarDlg::ScalarBarPreferences( SMESHGUI* theModule )
 {
   SMESHGUI_Preferences_ScalarBarDlg* aDlg =
-    new SMESHGUI_Preferences_ScalarBarDlg (parent, 0, true);
+    new SMESHGUI_Preferences_ScalarBarDlg( theModule, true);
   aDlg->exec();
 }
 
@@ -118,17 +119,16 @@ void SMESHGUI_Preferences_ScalarBarDlg::ScalarBarPreferences (QWidget* parent)
  *  Constructor
  */
 //=================================================================================================
-SMESHGUI_Preferences_ScalarBarDlg::SMESHGUI_Preferences_ScalarBarDlg (QWidget* parent,
-                                                                      SalomeApp_SelectionMgr* Sel,
-                                                                      bool modal)
-     : QDialog(parent, 0, modal, WStyle_Customize | WStyle_NormalBorder |
-               WStyle_Title | WStyle_SysMenu | WDestructiveClose)
+SMESHGUI_Preferences_ScalarBarDlg::SMESHGUI_Preferences_ScalarBarDlg( SMESHGUI* theModule, bool property, bool modal )
+     : QDialog( SMESH::GetDesktop( theModule ), 0, modal, WStyle_Customize | WStyle_NormalBorder |
+                WStyle_Title | WStyle_SysMenu | WDestructiveClose ),
+       mySMESHGUI( theModule ),
+       mySelectionMgr( property ? SMESH::GetSelectionMgr( theModule ) : 0 )
 {
   setName("SMESHGUI_Preferences_ScalarBarDlg");
-  setCaption(Sel ? tr("SMESH_PROPERTIES_SCALARBAR") : tr("SMESH_PREFERENCES_SCALARBAR"));
+  setCaption( property ? tr("SMESH_PROPERTIES_SCALARBAR") : tr("SMESH_PREFERENCES_SCALARBAR"));
   setSizeGripEnabled(TRUE);
 
-  mySelectionMgr = Sel;
   myActor = 0;
 
   /******************************************************************************/
@@ -326,7 +326,7 @@ SMESHGUI_Preferences_ScalarBarDlg::SMESHGUI_Preferences_ScalarBarDlg (QWidget* p
   /***************************************************************/
   // Init
   // --> first init from preferences
-  SUIT_ResourceMgr* mgr = SMESHGUI::resourceMgr();
+  SUIT_ResourceMgr* mgr = SMESH::GetResourceMgr( mySMESHGUI );
 
   QColor titleColor (255, 255, 255);
   if (mgr && mgr->hasValue("SMESH", "ScalarBarTitleColor")) {
@@ -429,7 +429,7 @@ SMESHGUI_Preferences_ScalarBarDlg::SMESHGUI_Preferences_ScalarBarDlg (QWidget* p
     connect( myApplyBtn,        SIGNAL( clicked() ), this, SLOT( onApply() ) );
     connect( mySelectionMgr,    SIGNAL( currentSelectionChanged() ), this, SLOT( onSelectionChanged() ) );
   }
-  connect( SMESHGUI::GetSMESHGUI(),  SIGNAL( SignalCloseAllDialogs() ), this, SLOT( onCancel() ) ) ;
+  connect( mySMESHGUI,  SIGNAL( SignalCloseAllDialogs() ), this, SLOT( onCancel() ) ) ;
 }
 
 //=================================================================================================
@@ -517,7 +517,7 @@ bool SMESHGUI_Preferences_ScalarBarDlg::onApply()
     SMESH::RepaintCurrentView();
   } else {
     // Scalar Bar preferences
-    SUIT_ResourceMgr* mgr = SMESHGUI::resourceMgr();
+    SUIT_ResourceMgr* mgr = SMESH::GetResourceMgr( mySMESHGUI );
     if (!mgr) return false;
 
     QColor titleColor = myTitleColorBtn->paletteBackgroundColor();
index f436c649cafb9010fafcfd2beaadde817eda7623..75fb1e4e44a7fdc2ef556e974c121c45e5e779b1 100644 (file)
@@ -41,6 +41,7 @@ class QPushButton;
 class QToolButton;
 class QRadioButton;
 class QSpinBox;
+class SMESHGUI;
 
 class QtxDblSpinBox;
 
@@ -54,11 +55,11 @@ class SMESHGUI_Preferences_ScalarBarDlg : public QDialog
 
 public:
   ~SMESHGUI_Preferences_ScalarBarDlg();
-  static void ScalarBarPreferences( QWidget* parent );
-  static void ScalarBarProperties ( QWidget* parent, SalomeApp_SelectionMgr* Sel );
+  static void ScalarBarPreferences( SMESHGUI* );
+  static void ScalarBarProperties ( SMESHGUI* );
 
 protected:
-  SMESHGUI_Preferences_ScalarBarDlg( QWidget* parent = 0, SalomeApp_SelectionMgr* Sel = 0, bool modal = FALSE );
+  SMESHGUI_Preferences_ScalarBarDlg( SMESHGUI*, bool, bool modal = FALSE );
   static SMESHGUI_Preferences_ScalarBarDlg* myDlg;
   void closeEvent( QCloseEvent* e );
   void setOriginAndSize( const double x, const double y, const double w, const double h );
@@ -74,6 +75,7 @@ protected slots:
   void onOrientationChanged();
 
 private:
+  SMESHGUI*                mySMESHGUI;
   SalomeApp_SelectionMgr*  mySelectionMgr;
   SMESH_Actor*             myActor;
   double                   myIniX, myIniY, myIniW, myIniH;
index 087739f47522937266ae15f295097613da2cc26b..7606ccf2b7768cf8dc8828291c39c0ee812f81a6 100644 (file)
 #include "SMESHGUI_Preferences_SelectionDlg.h"
 #include "SMESHGUI.h"
 
+#include "SMESHGUI_Utils.h"
+
+#include "SUIT_Desktop.h"
+
 #include <qgroupbox.h>
 #include <qlayout.h>
 #include <qlabel.h>
@@ -105,8 +109,9 @@ void SMESHGUI_DoubleValidator::fixup(QString& theText) const
 // class    : SMESHGUI_Preferences_SelectionDlg()
 // purpose  : 
 //=================================================================================
-SMESHGUI_Preferences_SelectionDlg::SMESHGUI_Preferences_SelectionDlg( QWidget* parent, const char* name )
-  : QDialog( parent, name, true, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
+SMESHGUI_Preferences_SelectionDlg::SMESHGUI_Preferences_SelectionDlg( SMESHGUI* theModule, const char* name )
+  : QDialog( SMESH::GetDesktop( theModule ), name, true, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu ),
+    mySMESHGUI( theModule )
 {
   if ( !name ) setName( "SMESHGUI_Preferences_SelectionDlg" );
   setCaption( tr( "SMESH_PREF_SELECTION"  ) );
@@ -203,7 +208,7 @@ SMESHGUI_Preferences_SelectionDlg::SMESHGUI_Preferences_SelectionDlg( QWidget* p
 
   /* Move widget on the botton right corner of main widget */
   int x, y ;
-  SMESHGUI::GetSMESHGUI()->DefineDlgPosition(this, x, y);
+  mySMESHGUI->DefineDlgPosition(this, x, y);
   this->move(x, y);
 }
 
index a4edd3865689095bec7a7a7f9d14833e9dde8f2d..07b7a644ad7cf4aa239de22568ff0d6dde1c15f9 100644 (file)
@@ -38,6 +38,7 @@
 class QPushButton;
 class QSpinBox;
 class QColor;
+class SMESHGUI;
 
 class SMESHGUI_LineEdit : public QLineEdit
 {
@@ -72,7 +73,7 @@ class SMESHGUI_Preferences_SelectionDlg : public QDialog
     Q_OBJECT
 
 public:
-    SMESHGUI_Preferences_SelectionDlg( QWidget* parent = 0, const char* name = 0 );
+    SMESHGUI_Preferences_SelectionDlg( SMESHGUI*, const char* name = 0 );
     ~SMESHGUI_Preferences_SelectionDlg();
 
     void   SetColor(int type, QColor color);
@@ -89,6 +90,7 @@ private slots:
     void onSelectColor();
 
 private:
+    SMESHGUI*             mySMESHGUI;
     QPushButton*          myColor[3];
     QSpinBox*             myWidth[2];
     QLineEdit*            myPrecision[2];
index 011402ab7c0680656a689acdbe920f72d73f6f29..62ef4d6ad73c190cabe00902f06d4bee69b32256 100644 (file)
@@ -86,8 +86,8 @@ SMESHGUI_RemoveElementsDlg
     mySMESHGUI(theModule),
     myBusy(false)
 {
-    QPixmap image0 (SMESHGUI::resourceMgr()->loadPixmap("SMESH", tr("ICON_DLG_REM_ELEMENT")));
-    QPixmap image1 (SMESHGUI::resourceMgr()->loadPixmap("SMESH", tr("ICON_SELECT")));
+    QPixmap image0 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_DLG_REM_ELEMENT")));
+    QPixmap image1 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_SELECT")));
 
     if (!name)
       setName("SMESHGUI_RemoveElementsDlg");
index 9df083576e8381ccbd6a0aa1e02c4ac784dd321b..d07fc087dd29df7b95c90583c71baa0e7bf88668 100644 (file)
@@ -86,8 +86,8 @@ SMESHGUI_RemoveNodesDlg
     mySMESHGUI(theModule),
     myBusy(false)
 {
-    QPixmap image0 (SMESHGUI::resourceMgr()->loadPixmap("SMESH", tr("ICON_DLG_REM_NODE")));
-    QPixmap image1 (SMESHGUI::resourceMgr()->loadPixmap("SMESH", tr("ICON_SELECT")));
+    QPixmap image0 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_DLG_REM_NODE")));
+    QPixmap image1 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_SELECT")));
 
     if (!name)
        setName("SMESHGUI_RemoveNodesDlg");
index f886e45d5f02995cb6b8f4dbaac3db767177264b..be16e7ede444ec7077ff27582e06b3e58bd105c0 100644 (file)
@@ -36,6 +36,7 @@
 #include "SMESH_TypeFilter.hxx"
 #include "SMDS_Mesh.hxx"
 
+#include "SUIT_Desktop.h"
 #include "SUIT_Session.h"
 
 #include "SALOME_ListIO.hxx"
@@ -59,11 +60,12 @@ using namespace std;
 // class    : SMESHGUI_RenumberingDlg()
 // purpose  :
 //=================================================================================
-SMESHGUI_RenumberingDlg::SMESHGUI_RenumberingDlg (QWidget* parent, const char* name,
-                                                  SalomeApp_SelectionMgr* Sel,
+SMESHGUI_RenumberingDlg::SMESHGUI_RenumberingDlg( SMESHGUI* theModule, const char* name,
                                                  const int unit, bool modal, WFlags fl)
-     : QDialog(parent, name, modal, WStyle_Customize | WStyle_NormalBorder |
-               WStyle_Title | WStyle_SysMenu | Qt::WDestructiveClose)
+     : QDialog( SMESH::GetDesktop( theModule ), name, modal, WStyle_Customize | WStyle_NormalBorder |
+               WStyle_Title | WStyle_SysMenu | Qt::WDestructiveClose),
+     mySMESHGUI( theModule ),
+     mySelectionMgr( SMESH::GetSelectionMgr( theModule ) )
 {
   myUnit = unit;
 
@@ -170,7 +172,7 @@ SMESHGUI_RenumberingDlg::SMESHGUI_RenumberingDlg (QWidget* parent, const char* n
   GroupMeshLayout->addWidget(LineEditMesh, 0, 2);
   SMESHGUI_RenumberingDlgLayout->addWidget(GroupMesh, 1, 0);
 
-  Init(Sel); /* Initialisations */
+  Init(); /* Initialisations */
 }
 
 //=================================================================================
@@ -186,13 +188,11 @@ SMESHGUI_RenumberingDlg::~SMESHGUI_RenumberingDlg()
 // function : Init()
 // purpose  :
 //=================================================================================
-void SMESHGUI_RenumberingDlg::Init (SalomeApp_SelectionMgr* Sel)
+void SMESHGUI_RenumberingDlg::Init()
 {
   GroupMesh->show();
   myConstructorId = 0;
   Constructor1->setChecked(TRUE);
-  mySelectionMgr = Sel;
-  mySMESHGUI = SMESHGUI::GetSMESHGUI();
   mySMESHGUI->SetActiveDialogBox((QDialog*)this);
 
   myMesh = SMESH::SMESH_Mesh::_nil();
index 74f89af67e8d3f3ae59f17643f7c4edb0a09084e..22e5fc6172d8d85859a3d6cf9950dffa166fa4a2 100644 (file)
@@ -60,17 +60,15 @@ class SMESHGUI_RenumberingDlg : public QDialog
     Q_OBJECT
 
 public:
-    SMESHGUI_RenumberingDlg (QWidget* parent = 0,
+    SMESHGUI_RenumberingDlg( SMESHGUI*,
                             const char* name = 0,
-                            SalomeApp_SelectionMgr* Sel = 0,
                             const int unit = 0,
                             bool modal = FALSE,
                             WFlags fl = 0);
     ~SMESHGUI_RenumberingDlg();
 
 private:
-
-    void Init( SalomeApp_SelectionMgr* Sel ) ;
+    void Init();
     void closeEvent( QCloseEvent* e ) ;
     void enterEvent ( QEvent * ) ;                         /* mouse enter the QWidget */
     void hideEvent ( QHideEvent * );                       /* ESC key */
index 731f9460d90045f80764fe69b3e411bc04349471..05fd466934a232ba4b6b597efab288bda23cf958 100644 (file)
@@ -87,9 +87,10 @@ SMESHGUI_RevolutionDlg::SMESHGUI_RevolutionDlg( SMESHGUI* theModule, const char*
      myViewWindow( SMESH::GetViewWindow( theModule ) ),
      mySelector( myViewWindow->GetSelector() )
 {
-  QPixmap image0 (SMESHGUI::resourceMgr()->loadPixmap("SMESH", tr("ICON_DLG_EDGE")));
-  QPixmap image1 (SMESHGUI::resourceMgr()->loadPixmap("SMESH", tr("ICON_DLG_TRIANGLE")));
-  QPixmap image2 (SMESHGUI::resourceMgr()->loadPixmap("SMESH", tr("ICON_SELECT")));
+  SUIT_ResourceMgr* mgr = SMESH::GetResourceMgr( mySMESHGUI );
+  QPixmap image0 ( mgr->loadPixmap("SMESH", tr("ICON_DLG_EDGE")));
+  QPixmap image1 ( mgr->loadPixmap("SMESH", tr("ICON_DLG_TRIANGLE")));
+  QPixmap image2 ( mgr->loadPixmap("SMESH", tr("ICON_SELECT")));
 
   if (!name)
     setName("SMESHGUI_RevolutionDlg");
index 6d603a53aae2637f8a04e53ddc8e8e625f32e896..8b9b6b70d89e93fa79ff65baa189f493ee5b32fe 100644 (file)
@@ -86,8 +86,8 @@ SMESHGUI_RotationDlg::SMESHGUI_RotationDlg( SMESHGUI* theModule, const char* nam
      myViewWindow( SMESH::GetViewWindow( theModule ) ),
      mySelector( myViewWindow->GetSelector() )
 {
-  QPixmap image0 (SMESHGUI::resourceMgr()->loadPixmap("SMESH", tr("ICON_DLG_ROTATION")));
-  QPixmap image1 (SMESHGUI::resourceMgr()->loadPixmap("SMESH", tr("ICON_SELECT")));
+  QPixmap image0 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_DLG_ROTATION")));
+  QPixmap image1 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_SELECT")));
 
   if (!name)
     setName("SMESHGUI_RotationDlg");
index a84e3834d40326526fa171fdc64a2fc730051f42..dab2df03253f5f7c0c2ba4a4562723815c6008b2 100644 (file)
@@ -79,11 +79,12 @@ SMESHGUI_SewingDlg::SMESHGUI_SewingDlg( SMESHGUI* theModule, const char* name,
       myViewWindow( SMESH::GetViewWindow( theModule ) ),
       mySelector( myViewWindow->GetSelector() )
 {
-  QPixmap image0 (SMESHGUI::resourceMgr()->loadPixmap("SMESH", tr("ICON_SMESH_SEWING_FREEBORDERS")));
-  QPixmap image1 (SMESHGUI::resourceMgr()->loadPixmap("SMESH", tr("ICON_SMESH_SEWING_CONFORM_FREEBORDERS")));
-  QPixmap image2 (SMESHGUI::resourceMgr()->loadPixmap("SMESH", tr("ICON_SMESH_SEWING_BORDERTOSIDE")));
-  QPixmap image3 (SMESHGUI::resourceMgr()->loadPixmap("SMESH", tr("ICON_SMESH_SEWING_SIDEELEMENTS")));
-  QPixmap image4 (SMESHGUI::resourceMgr()->loadPixmap("SMESH", tr("ICON_SELECT")));
+  SUIT_ResourceMgr* mgr = SMESH::GetResourceMgr( mySMESHGUI );
+  QPixmap image0 (mgr->loadPixmap("SMESH", tr("ICON_SMESH_SEWING_FREEBORDERS")));
+  QPixmap image1 (mgr->loadPixmap("SMESH", tr("ICON_SMESH_SEWING_CONFORM_FREEBORDERS")));
+  QPixmap image2 (mgr->loadPixmap("SMESH", tr("ICON_SMESH_SEWING_BORDERTOSIDE")));
+  QPixmap image3 (mgr->loadPixmap("SMESH", tr("ICON_SMESH_SEWING_SIDEELEMENTS")));
+  QPixmap image4 (mgr->loadPixmap("SMESH", tr("ICON_SELECT")));
 
   if (!name)
     setName("SMESHGUI_SewingDlg");
index cf7750be8bf7c5d3688e80597696e6c039036199..404d6a6d82a5e286bf4709e52ee0204b1e99e18e 100755 (executable)
@@ -137,7 +137,7 @@ QFrame* SMESHGUI_SingleEditDlg::createMainFrame (QWidget* theParent)
 {
   QGroupBox* aMainGrp = new QGroupBox(1, Qt::Vertical, tr("EDGE_BETWEEN"), theParent);
 
-  QPixmap aPix (SMESHGUI::resourceMgr()->loadPixmap("SMESH", tr("ICON_SELECT")));
+  QPixmap aPix (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_SELECT")));
 
   new QLabel(tr("SMESH_EDGE"), aMainGrp);
   (new QPushButton(aMainGrp))->setPixmap(aPix);
index 3adcb19c5021a18438aa1a81757dff4a38e544ec..caec59a2c5dcb99d14da9f98eb80c246a0d897b4 100644 (file)
@@ -93,8 +93,8 @@ SMESHGUI_SmoothingDlg::SMESHGUI_SmoothingDlg( SMESHGUI* theModule, const char* n
      myViewWindow( SMESH::GetViewWindow( theModule ) ),
      mySelector( myViewWindow->GetSelector() )
 {
-  QPixmap image0 (SMESHGUI::resourceMgr()->loadPixmap("SMESH", tr("ICON_DLG_SMOOTHING")));
-  QPixmap image1 (SMESHGUI::resourceMgr()->loadPixmap("SMESH", tr("ICON_SELECT")));
+  QPixmap image0 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_DLG_SMOOTHING")));
+  QPixmap image1 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_SELECT")));
 
   if (!name)
     setName("SMESHGUI_SmoothingDlg");
index 3b7916938be2c0666c903c9e9282aabd235af895..8960524b3d909d19d37506fff201b059d381bc6a 100644 (file)
@@ -38,6 +38,7 @@
 #include "SALOMEDSClient_Study.hxx"
 #include "SALOMEDSClient_SObject.hxx"
 
+#include "SUIT_Desktop.h"
 #include "SUIT_Session.h"
 #include "SUIT_OverrideCursor.h"
 
@@ -71,10 +72,12 @@ using namespace std;
  *  Constructor
  */
 //=================================================================================
-SMESHGUI_StandardMeshInfosDlg::SMESHGUI_StandardMeshInfosDlg (QWidget* parent, const char* name,
+SMESHGUI_StandardMeshInfosDlg::SMESHGUI_StandardMeshInfosDlg( SMESHGUI* theModule, const char* name,
                                                               bool modal, WFlags fl)
-     : QDialog(parent, name, modal, WStyle_Customize | WStyle_NormalBorder |
-               WStyle_Title | WStyle_SysMenu | WDestructiveClose)
+     : QDialog( SMESH::GetDesktop( theModule ), name, modal, WStyle_Customize | WStyle_NormalBorder |
+                WStyle_Title | WStyle_SysMenu | WDestructiveClose),
+     mySMESHGUI( theModule ),
+     mySelectionMgr( SMESH::GetSelectionMgr( theModule ) )
 {
   if (!name)
       setName("SMESHGUI_StandardMeshInfosDlg");
@@ -150,20 +153,19 @@ SMESHGUI_StandardMeshInfosDlg::SMESHGUI_StandardMeshInfosDlg (QWidget* parent, c
 
   aDlgLayout->addWidget(myButtonsGroup, 2, 0);
 
-  mySelectionMgr = SMESHGUI::selectionMgr();
-  SMESHGUI::GetSMESHGUI()->SetActiveDialogBox(this);
+  mySMESHGUI->SetActiveDialogBox(this);
 
   // connect signals
-  connect(myOkBtn,                 SIGNAL(clicked()),                      this, SLOT(close()));
-  connect(mySelectBtn,             SIGNAL(clicked()),                      this, SLOT(onStartSelection()));
-  connect(SMESHGUI::GetSMESHGUI(), SIGNAL(SignalCloseAllDialogs()),        this, SLOT(close()));
-  connect(SMESHGUI::GetSMESHGUI(), SIGNAL(SignalDeactivateActiveDialog()), this, SLOT(DeactivateActiveDialog()));
-  connect(mySelectionMgr,          SIGNAL(currentSelectionChanged()),      this, SLOT(onSelectionChanged()));
+  connect( myOkBtn,         SIGNAL(clicked()),                      this, SLOT(close()));
+  connect( mySelectBtn,     SIGNAL(clicked()),                      this, SLOT(onStartSelection()));
+  connect( mySMESHGUI,      SIGNAL(SignalCloseAllDialogs()),        this, SLOT(close()));
+  connect( mySMESHGUI,      SIGNAL(SignalDeactivateActiveDialog()), this, SLOT(DeactivateActiveDialog()));
+  connect( mySelectionMgr,  SIGNAL(currentSelectionChanged()),      this, SLOT(onSelectionChanged()));
 
   // resize and move dialog, then show
   this->setMinimumSize(270, 428);
   int x, y;
-  SMESHGUI::GetSMESHGUI()->DefineDlgPosition(this, x, y);
+  mySMESHGUI->DefineDlgPosition(this, x, y);
   this->move(x, y);
   this->show();
 
@@ -394,7 +396,7 @@ void SMESHGUI_StandardMeshInfosDlg::onSelectionChanged()
 void SMESHGUI_StandardMeshInfosDlg::closeEvent (QCloseEvent* e)
 {
   mySelectionMgr->clearFilters();
-  SMESHGUI::GetSMESHGUI()->ResetState();
+  mySMESHGUI->ResetState();
   QDialog::closeEvent(e);
 }
 
@@ -426,7 +428,7 @@ void SMESHGUI_StandardMeshInfosDlg::DeactivateActiveDialog()
 void SMESHGUI_StandardMeshInfosDlg::ActivateThisDialog()
 {
   /* Emit a signal to deactivate any active dialog */
-  SMESHGUI::GetSMESHGUI()->EmitSignalDeactivateDialog();
+  mySMESHGUI->EmitSignalDeactivateDialog();
   connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(onSelectionChanged()));
 }
 
index 857be0d4d7eff497fda3be44461d7564b3e4990a..7fcbdc239b3e4c238f8ee1c2d8580b7fbbbb0287 100644 (file)
@@ -41,13 +41,15 @@ class QPushButton;
 class QLineEdit;
 class QTextBrowser;
 class SalomeApp_SelectionMgr;
+class SMESHGUI;
+
 
 class SMESHGUI_StandardMeshInfosDlg : public QDialog
 { 
     Q_OBJECT
 
 public:
-    SMESHGUI_StandardMeshInfosDlg( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 );
+    SMESHGUI_StandardMeshInfosDlg( SMESHGUI*, const char* name = 0, bool modal = FALSE, WFlags fl = 0 );
     ~SMESHGUI_StandardMeshInfosDlg();
 
 protected:
@@ -62,6 +64,7 @@ private slots:
     void onStartSelection();
 
 private:
+    SMESHGUI*                mySMESHGUI;
     SalomeApp_SelectionMgr*  mySelectionMgr; 
     bool                     myStartSelection;
     bool                     myIsActiveWindow;
index a49f6cef94fd6af5b10ddc542e67333233795004..225586edd324fce3424c8a663d5573e0467c2f17 100644 (file)
@@ -86,10 +86,10 @@ SMESHGUI_SymmetryDlg::SMESHGUI_SymmetryDlg( SMESHGUI* theModule, const char* nam
       myViewWindow( SMESH::GetViewWindow( theModule ) ),
       mySelector( myViewWindow->GetSelector() )
 {
-  QPixmap image0 (SMESHGUI::resourceMgr()->loadPixmap("SMESH", tr("ICON_SMESH_SYMMETRY_POINT")));
-  QPixmap image1 (SMESHGUI::resourceMgr()->loadPixmap("SMESH", tr("ICON_SMESH_SYMMETRY_AXIS")));
-  QPixmap image2 (SMESHGUI::resourceMgr()->loadPixmap("SMESH", tr("ICON_SMESH_SYMMETRY_PLANE")));
-  QPixmap image3 (SMESHGUI::resourceMgr()->loadPixmap("SMESH", tr("ICON_SELECT")));
+  QPixmap image0 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_SMESH_SYMMETRY_POINT")));
+  QPixmap image1 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_SMESH_SYMMETRY_AXIS")));
+  QPixmap image2 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_SMESH_SYMMETRY_PLANE")));
+  QPixmap image3 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_SELECT")));
 
   if (!name)
     setName("SMESHGUI_SymmetryDlg");
index 5ab553b229231098dd33258282db439f9c092d2a..649ae0d747ae5d85e49cdc86b3b7cd247051f990 100644 (file)
@@ -87,9 +87,9 @@ SMESHGUI_TranslationDlg::SMESHGUI_TranslationDlg( SMESHGUI* theModule, const cha
      myViewWindow( SMESH::GetViewWindow( theModule ) ),
      mySelector( myViewWindow->GetSelector() )
 {
-  QPixmap image0 (SMESHGUI::resourceMgr()->loadPixmap("SMESH", tr("ICON_SMESH_TRANSLATION_POINTS")));
-  QPixmap image1 (SMESHGUI::resourceMgr()->loadPixmap("SMESH", tr("ICON_SMESH_TRANSLATION_VECTOR")));
-  QPixmap image2 (SMESHGUI::resourceMgr()->loadPixmap("SMESH", tr("ICON_SELECT")));
+  QPixmap image0 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_SMESH_TRANSLATION_POINTS")));
+  QPixmap image1 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_SMESH_TRANSLATION_VECTOR")));
+  QPixmap image2 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_SELECT")));
 
   if (!name)
     setName("SMESHGUI_TranslationDlg");
index b121d1113c0ae9a1d2e5f8b4c7ce0c2ec19202c1..283306aa4e90479e82792f8ed42ebaaacd63bac8 100644 (file)
 
 #include "SMESHGUI.h"
 #include "SMESHGUI_VTKUtils.h"
-
+#include "SMESHGUI_Utils.h"
 #include "SMESH_Actor.h"
 
+#include "SUIT_Desktop.h"
 #include "SUIT_OverrideCursor.h"
 
 #include "SALOME_ListIO.hxx"
@@ -58,12 +59,15 @@ using namespace std;
 // purpose  :
 //
 //=================================================================================
-SMESHGUI_TransparencyDlg::SMESHGUI_TransparencyDlg (QWidget* parent,
+SMESHGUI_TransparencyDlg::SMESHGUI_TransparencyDlg( SMESHGUI* theModule,
                                                    const char* name,
                                                    bool modal,
                                                    WFlags fl)
-     : QDialog(parent, name, modal, WStyle_Customize | WStyle_NormalBorder |
-               WStyle_Title | WStyle_SysMenu | WDestructiveClose)
+     : QDialog( SMESH::GetDesktop( theModule ), name, modal, WStyle_Customize | WStyle_NormalBorder |
+                WStyle_Title | WStyle_SysMenu | WDestructiveClose ),
+     mySMESHGUI( theModule ),
+     mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ),
+     myViewWindow( SMESH::GetViewWindow( theModule ) )
 {
   if (!name)
     setName("SMESHGUI_TransparencyDlg");
@@ -132,8 +136,6 @@ SMESHGUI_TransparencyDlg::SMESHGUI_TransparencyDlg (QWidget* parent,
   SMESHGUI_TransparencyDlgLayout->addWidget(GroupC1,      0, 0);
   SMESHGUI_TransparencyDlgLayout->addWidget(GroupButtons, 1, 0);
 
-  mySelectionMgr = SMESHGUI::selectionMgr();
-
   // Initial state
   this->onSelectionChanged();
 
@@ -141,12 +143,12 @@ SMESHGUI_TransparencyDlg::SMESHGUI_TransparencyDlg (QWidget* parent,
   connect(buttonOk, SIGNAL(clicked()),         this, SLOT(ClickOnOk()));
   connect(Slider1,  SIGNAL(valueChanged(int)), this, SLOT(SetTransparency()));
   connect(Slider1,  SIGNAL(sliderMoved(int)),  this, SLOT(ValueHasChanged()));
-  connect(SMESHGUI::GetSMESHGUI(), SIGNAL (SignalCloseAllDialogs()), this, SLOT(ClickOnOk()));
+  connect(mySMESHGUI, SIGNAL (SignalCloseAllDialogs()), this, SLOT(ClickOnOk()));
   connect(mySelectionMgr,  SIGNAL(currentSelectionChanged()), this, SLOT(onSelectionChanged()));
 
   /* Move widget on the botton right corner of main widget */
   int x, y;
-  SMESHGUI::GetSMESHGUI()->DefineDlgPosition(this, x, y);
+  mySMESHGUI->DefineDlgPosition(this, x, y);
   this->move(x, y);
   this->show();
 }
@@ -176,7 +178,7 @@ void SMESHGUI_TransparencyDlg::ClickOnOk()
 //=================================================================================
 void SMESHGUI_TransparencyDlg::SetTransparency()
 {
-  if (SVTK_ViewWindow* aVTKViewWindow = SMESH::GetCurrentVtkView()) {
+  if( myViewWindow ) {
     SUIT_OverrideCursor wc;
     float opacity = this->Slider1->value() / 100.;
 
@@ -190,7 +192,7 @@ void SMESHGUI_TransparencyDlg::SetTransparency()
       if (anActor)
        anActor->SetOpacity(opacity);
     }
-    aVTKViewWindow->Repaint();
+    myViewWindow->Repaint();
   }
   ValueHasChanged();
 }
@@ -210,7 +212,7 @@ void SMESHGUI_TransparencyDlg::ValueHasChanged()
 //=================================================================================
 void SMESHGUI_TransparencyDlg::onSelectionChanged()
 {
-  if (SVTK_ViewWindow* aVTKViewWindow = SMESH::GetCurrentVtkView()) {
+  if( myViewWindow ) {
     int opacity = 100;
 
     SALOME_ListIO aList;
index 211f06ee549a4cf6e6dd1a9a8ba7dd3b897ac6dc..c1cced61e43939e055f4a7aeee712b0dc6ec535a 100644 (file)
@@ -36,6 +36,9 @@ class QLabel;
 class QPushButton;
 class QSlider;
 class SalomeApp_SelectionMgr;
+class SVTK_Selector;
+class SVTK_ViewWindow;
+class SMESHGUI;
 
 //=================================================================================
 // class    : SMESHGUI_TransparencyDlg
@@ -46,7 +49,7 @@ class SMESHGUI_TransparencyDlg : public QDialog
     Q_OBJECT
 
 public:
-    SMESHGUI_TransparencyDlg( QWidget* parent = 0,
+    SMESHGUI_TransparencyDlg( SMESHGUI*,
                              const char* name = 0,
                              bool modal = false,
                              WFlags fl = 0 );
@@ -55,13 +58,15 @@ public:
 
 private :
 
-    SalomeApp_SelectionMgr* mySelectionMgr;
+  SMESHGUI*               mySMESHGUI;
+  SalomeApp_SelectionMgr* mySelectionMgr;
+  SVTK_ViewWindow*        myViewWindow;
 
-    QPushButton*      buttonOk;
-    QLabel*           TextLabelOpaque;
-    QLabel*           ValueLab;
-    QLabel*           TextLabelTransparent;
-    QSlider*          Slider1;
+  QPushButton*      buttonOk;
+  QLabel*           TextLabelOpaque;
+  QLabel*           ValueLab;
+  QLabel*           TextLabelTransparent;
+  QSlider*          Slider1;
 
 public slots:
       
index 3b4976ea61c16e7e7de373eed84a403734b14a11..7dbc44c72ba63c0bd19d3d95c8c6bd3ea7e9f810 100644 (file)
@@ -56,6 +56,11 @@ namespace SMESH{
     return theModule->getApp()->selectionMgr();
   }
 
+  SUIT_ResourceMgr*
+  GetResourceMgr( const SalomeApp_Module* )
+  {
+    return SUIT_Session::session()->resourceMgr();
+  }
 
   _PTR(Study)
   GetCStudy(const SalomeApp_Study* theStudy)
index 15009ab9540167f0d7361434d8ab86768e7cee77..69e1f61604e0e3f1559fbe426e041536177e9825 100644 (file)
@@ -31,6 +31,7 @@ class QString;
 class SUIT_ViewWindow;
 class SUIT_Desktop;
 class SUIT_Study;
+class SUIT_ResourceMgr;
 
 class CAM_Module;
 
@@ -52,6 +53,9 @@ namespace SMESH {
   SalomeApp_Study*
   GetAppStudy(const CAM_Module* theModule);
 
+  SUIT_ResourceMgr*
+  GetResourceMgr( const SalomeApp_Module* );
+  
   _PTR(Study)
   GetCStudy(const SalomeApp_Study* theStudy);
 
index 07c1ce1f9452378fe1b8bb2b1b45eb0dca2f5439..03145925ff81be452f060bfa901cb6b6bcb34c8b 100644 (file)
@@ -30,6 +30,7 @@
 #include "SMESHGUI_aParameter.h"
 #include "SMESHGUI.h"
 #include "SMESHGUI_SpinBox.h"
+#include "SMESHGUI_Utils.h"
 
 #include "SUIT_Tools.h"
 #include "SUIT_Desktop.h"
@@ -53,13 +54,14 @@ using namespace std;
 //
 //======================================================================================
 SMESHGUI_aParameterDlg::SMESHGUI_aParameterDlg
-                                        (std::list<SMESHGUI_aParameterPtr> params,
-                                         QWidget*                          parent,
+                                       ( SMESHGUI* theModule,
+                                        std::list<SMESHGUI_aParameterPtr> params,
                                          QString                           title,
                                          bool                              modal)
-: QDialog(parent, "MyParameterDialog", modal, WStyle_Customize |
-          WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu),
-  myParamList(params)
+: QDialog( SMESH::GetDesktop( theModule ), "MyParameterDialog", modal, WStyle_Customize |
+           WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu),          
+  myParamList(params),
+  mySMESHGUI(theModule)
 {
   /* creating widgets */
   init();
@@ -67,7 +69,7 @@ SMESHGUI_aParameterDlg::SMESHGUI_aParameterDlg
   setCaption(title);
 
   /* Move widget on the botton right corner of main widget */
-  SUIT_Tools::centerWidget(this, parent);
+  SUIT_Tools::centerWidget(this, SMESH::GetDesktop( theModule ) );
 }
 
 //======================================================================================
@@ -159,9 +161,6 @@ void SMESHGUI_aParameterDlg::init()
   /* signals and slots connections */
   connect(myButtonOk,     SIGNAL(clicked()), this, SLOT(ClickOnOk()));
   connect(myButtonCancel, SIGNAL(clicked()), this, SLOT(reject()));
-
-  /* Retrieve SMESHGUI */
-  mySMESHGUI = SMESHGUI::GetSMESHGUI();
 }
 
 //======================================================================================
@@ -194,12 +193,13 @@ void SMESHGUI_aParameterDlg::ClickOnOk()
 // function : Parameters()
 // purpose  : return a list of parameters from a dialog box
 //=======================================================================
-bool SMESHGUI_aParameterDlg::Parameters (list<SMESHGUI_aParameterPtr> params,
+bool SMESHGUI_aParameterDlg::Parameters( SMESHGUI* theModule, 
+                                        list<SMESHGUI_aParameterPtr> params,
                                          const char *aTitle)
 {
   if (!params.empty()) {
     SMESHGUI_aParameterDlg *Dialog =
-      new SMESHGUI_aParameterDlg(params, SMESHGUI::desktop(), aTitle, TRUE);
+      new SMESHGUI_aParameterDlg( theModule, params, aTitle, TRUE);
     return (Dialog->exec() == QDialog::Accepted);
   }
   return false;
index 7c9cd19aa9f7af982d2365da5b65751f377650ee..0c53672b2e01eaad64c34b11c5f040fb4cd09e2c 100644 (file)
@@ -49,15 +49,15 @@ class SMESHGUI_aParameterDlg : public QDialog
     Q_OBJECT
 
 public:
-    SMESHGUI_aParameterDlg (std::list<SMESHGUI_aParameterPtr> params,
-                           QWidget*                          parent = 0,
+    SMESHGUI_aParameterDlg( SMESHGUI*,
+                           std::list<SMESHGUI_aParameterPtr> params,
                            QString                           title  = QString::null,
                            bool                              modal  = TRUE);
 
     ~SMESHGUI_aParameterDlg();
 
     /* Parameter function */
-    static bool Parameters (std::list<SMESHGUI_aParameterPtr> params, const char *aTitle);
+    static bool Parameters( SMESHGUI*, std::list<SMESHGUI_aParameterPtr> params, const char *aTitle);
 
 protected:
     void init();
index aa7bd34bd3bdf86de5c09256dbb13783696bb87f..93322c3e76b3255dd93e481f1e3bd45ddf2d953b 100644 (file)
@@ -121,7 +121,7 @@ void StdMeshersGUI_HypothesisCreator::EditHypothesis
   StdMeshersGUI_Parameters::GetParameters( theHyp, paramList );
 
   bool modified = false;
-  if ( SMESHGUI_aParameterDlg::Parameters( paramList, QObject::tr("SMESH_VALUE")) )
+  if ( SMESHGUI_aParameterDlg::Parameters( SMESHGUI::GetSMESHGUI(), paramList, QObject::tr("SMESH_VALUE")) )
     modified = StdMeshersGUI_Parameters::SetParameters( theHyp, paramList );
 
   if ( modified ) {