Salome HOME
Porting SMESH module to Qt 4
[modules/smesh.git] / src / SMESHGUI / SMESHGUI.cxx
index 89ce6fe7a9880b49a2f379d8650046e5c2b9fae2..bc7537e0a08de810712dd05268a984ddc5e5fcbc 100644 (file)
@@ -1,32 +1,30 @@
-//  SMESH SMESHGUI : GUI for SMESH component
+// 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
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
-//  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.
+// File   : SMESHGUI.cxx
+// Author : Nicolas REJNERI, Open CASCADE S.A.S.
 //
-//  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.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-//  File   : SMESHGUI.cxx
-//  Author : Nicolas REJNERI
-//  Module : SMESH
-//  $Header$
 
+// SMESH includes
 #include "SMESHGUI.h"
-
-#include "SMESH_Client.hxx"
 #include "SMESHGUI_NodesDlg.h"
 #include "SMESHGUI_TransparencyDlg.h"
 #include "SMESHGUI_ClippingDlg.h"
@@ -35,9 +33,9 @@
 #include "SMESHGUI_RemoveElementsDlg.h"
 #include "SMESHGUI_MeshInfosDlg.h"
 #include "SMESHGUI_StandardMeshInfosDlg.h"
+#include "SMESHGUI_WhatIsDlg.h"
 #include "SMESHGUI_Preferences_ColorDlg.h"
 #include "SMESHGUI_Preferences_ScalarBarDlg.h"
-#include "SMESHGUI_Preferences_SelectionDlg.h"
 #include "SMESHGUI_Hypotheses.h"
 #include "SMESHGUI_MoveNodesDlg.h"
 #include "SMESHGUI_AddMeshElementDlg.h"
@@ -69,7 +67,6 @@
 #include "SMESHGUI_ComputeDlg.h"
 
 #include "SMESHGUI_Utils.h"
-#include "SMESHGUI_GEOMGenUtils.h"
 #include "SMESHGUI_MeshUtils.h"
 #include "SMESHGUI_GroupUtils.h"
 #include "SMESHGUI_FilterUtils.h"
 #include "SMESHGUI_VTKUtils.h"
 #include "SMESHGUI_HypothesesUtils.h"
 
-#include "SMESH_Actor.h"
-#include "SMESH_Object.h"
-#include "SMESH_TypeFilter.hxx"
+#include <SMESH_Client.hxx>
+#include <SMESH_Actor.h>
+#include <SMESH_TypeFilter.hxx>
 
-#include "SalomeApp_Tools.h"
-#include "SalomeApp_Study.h"
-#include "SalomeApp_Application.h"
-#include "SalomeApp_CheckFileDlg.h"
-#include "SalomeApp_ImportOperation.h"
+// SALOME GUI includes
+#include <SalomeApp_Tools.h>
+#include <SalomeApp_Study.h>
+#include <SalomeApp_Application.h>
+#include <SalomeApp_CheckFileDlg.h>
 
-#include "LightApp_DataOwner.h"
-#include "LightApp_Preferences.h"
-#include "LightApp_VTKSelector.h"
-#include "LightApp_Operation.h"
-#include "LightApp_UpdateFlags.h"
-#include "LightApp_NameDlg.h"
+#include <LightApp_DataOwner.h>
+#include <LightApp_Preferences.h>
+#include <LightApp_SelectionMgr.h>
+#include <LightApp_UpdateFlags.h>
+#include <LightApp_NameDlg.h>
 
 #include <SVTK_ViewWindow.h>
 #include <SVTK_ViewModel.h>
-#include <SVTK_InteractorStyle.h>
-#include <SVTK_RenderWindowInteractor.h>
 #include <SVTK_ViewManager.h>
 
-#include "OB_Browser.h"
+#include <SUIT_MessageBox.h>
+#include <SUIT_ResourceMgr.h>
+#include <SUIT_FileDlg.h>
+#include <SUIT_Desktop.h>
+#include <SUIT_OverrideCursor.h>
+#include <SUIT_Session.h>
 
-#include "SUIT_Tools.h"
-#include "SUIT_MessageBox.h"
-#include "SUIT_ResourceMgr.h"
-#include "SUIT_FileDlg.h"
-#include "SUIT_Desktop.h"
-#include "SUIT_OverrideCursor.h"
-#include "SUIT_Study.h"
-#include "SUIT_Session.h"
+#include <QtxPopupMgr.h>
+#include <QtxFontEdit.h>
 
-#include "QtxPopupMgr.h"
+#include <SALOME_ListIO.hxx>
+#include <SALOME_ListIteratorOfListIO.hxx>
 
-#include "SALOME_ListIO.hxx"
-#include "SALOME_ListIteratorOfListIO.hxx"
-#include "SALOME_InteractiveObject.hxx"
-#include "SALOME_NamingService.hxx"
-#include "SALOME_LifeCycleCORBA.hxx"
-
-#include "SALOMEconfig.h"
+// IDL includes
+#include <SALOMEconfig.h>
 #include CORBA_CLIENT_HEADER(SALOMEDS_Attributes)
 #include CORBA_SERVER_HEADER(SMESH_MeshEditor)
 
-// QT Includes
-#define         INCLUDE_MENUITEM_DEF
-#include <qpopupmenu.h>
-#include <qstring.h>
-#include <qwidget.h>
-#include <qaction.h>
+// Qt includes
+// #define      INCLUDE_MENUITEM_DEF // VSR commented ????????
+#include <QMenu>
 
-// BOOST Includes
+// BOOST includes
 #include <boost/shared_ptr.hpp>
 
-// VTK Includes
-#include <vtkRenderer.h>
-#include <vtkRenderWindow.h>
-#include <vtkActorCollection.h>
+// VTK includes
 #include <vtkScalarBarActor.h>
-#include <vtkUnstructuredGrid.h>
-
-#include "utilities.h"
 
-#include "SALOMEDS_Study.hxx"
-#include "SALOMEDSClient_StudyBuilder.hxx"
-#include "SALOMEDSClient_SComponent.hxx"
+// SALOME KERNEL includes
+#include <SALOMEDS_Study.hxx>
+#include <SALOMEDSClient_StudyBuilder.hxx>
+#include <SALOMEDSClient_SComponent.hxx>
 
-using namespace std;
+// OCCT includes
+#include <Standard_ErrorHandler.hxx>
 
 //namespace{
   // Declarations
@@ -194,19 +176,19 @@ using namespace std;
        case 112:
          {
            aMeshes->length( 1 );
-           aMeshes[0] = theComponentMesh->CreateMeshesFromUNV(filename.latin1());
+           aMeshes[0] = theComponentMesh->CreateMeshesFromUNV(filename.toLatin1().data());
            break;
          }
        case 113:
          {
            SMESH::DriverMED_ReadStatus res;
-           aMeshes = theComponentMesh->CreateMeshesFromMED(filename.latin1(),res);
+           aMeshes = theComponentMesh->CreateMeshesFromMED(filename.toLatin1().data(),res);
            if ( res != SMESH::DRS_OK ) {
              wc.suspend();
-             SUIT_MessageBox::warn1(SMESHGUI::desktop(),
-                                   QObject::tr("SMESH_WRN_WARNING"),
-                                   QObject::tr(QString("SMESH_DRS_%1").arg(res)),
-                                   QObject::tr("SMESH_BUT_OK"));
+             SUIT_MessageBox::warning(SMESHGUI::desktop(),
+                                      QObject::tr("SMESH_WRN_WARNING"),
+                                      QObject::tr(QString("SMESH_DRS_%1").arg(res).
+                                                  toLatin1().data()));
              aMeshes->length( 0 );
              wc.resume();
            }
@@ -229,10 +211,9 @@ using namespace std;
 
        if ( isEmpty ) {
          wc.suspend();
-         SUIT_MessageBox::warn1(SMESHGUI::desktop(),
-                               QObject::tr("SMESH_WRN_WARNING"),
-                               QObject::tr("SMESH_DRS_EMPTY"),
-                               QObject::tr("SMESH_BUT_OK"));
+         SUIT_MessageBox::warning(SMESHGUI::desktop(),
+                                  QObject::tr("SMESH_WRN_WARNING"),
+                                  QObject::tr("SMESH_DRS_EMPTY"));
          wc.resume();
        }
 
@@ -266,18 +247,19 @@ using namespace std;
        case 122:
           {
            if (aMesh->HasDuplicatedGroupNamesMED()) {
-              int aRet = SUIT_MessageBox::warn2
+              int aRet = SUIT_MessageBox::warning
                 (SMESHGUI::desktop(),
                  QObject::tr("SMESH_WRN_WARNING"),
                  QObject::tr("SMESH_EXPORT_MED_DUPLICATED_GRP").arg(anIObject->getName()),
-                 QObject::tr("SMESH_BUT_YES"),  QObject::tr("SMESH_BUT_NO"),
-                 0, 1, 0);
-              if (aRet)
+                SUIT_MessageBox::Yes | SUIT_MessageBox::No, SUIT_MessageBox::Yes);
+              if (aRet != SUIT_MessageBox::Yes)
                 return;
             }
-
-            aFilterMap.insert( QObject::tr("MED 2.1 (*.med)"), SMESH::MED_V2_1 );
-            aFilterMap.insert( QObject::tr("MED 2.2 (*.med)"), SMESH::MED_V2_2 );
+            // PAL18696
+            QString v21( aMesh->GetVersionString( SMESH::MED_V2_1, 2));
+            QString v22( aMesh->GetVersionString( SMESH::MED_V2_2, 2));
+            aFilterMap.insert( QString("MED ") +  v21 + " (*.med)", SMESH::MED_V2_1 );
+            aFilterMap.insert( QString("MED ") +  v22 + " (*.med)", SMESH::MED_V2_2 );
           }
          break;
        case 124:
@@ -288,13 +270,12 @@ using namespace std;
        case 123:
           {
             if (aMesh->NbPyramids()) {
-              int aRet = SUIT_MessageBox::warn2
+              int aRet = SUIT_MessageBox::warning
                 (SMESHGUI::desktop(),
                  QObject::tr("SMESH_WRN_WARNING"),
                  QObject::tr("SMESH_EXPORT_UNV").arg(anIObject->getName()),
-                 QObject::tr("SMESH_BUT_YES"),  QObject::tr("SMESH_BUT_NO"),
-                 0, 1, 0);
-              if (aRet)
+                SUIT_MessageBox::Yes | SUIT_MessageBox::No, SUIT_MessageBox::Yes);
+              if (aRet != SUIT_MessageBox::Yes)
                 return;
             }
             aFilter = QObject::tr("IDEAS files (*.unv)");
@@ -308,21 +289,19 @@ using namespace std;
              there must be check on others mesh elements not equal triangles
            */
            if (aMesh->NbTriangles() < 1) {
-              int aRet = SUIT_MessageBox::warn1
+              SUIT_MessageBox::warning
                 (SMESHGUI::desktop(),
                  QObject::tr("SMESH_WRN_WARNING"),
-                 QObject::tr("SMESH_EXPORT_STL1").arg(anIObject->getName()),
-                 QObject::tr("SMESH_BUT_OK"));
+                 QObject::tr("SMESH_EXPORT_STL1").arg(anIObject->getName()));
              return;
             }
            if (!(aMesh->NbElements() - aMesh->NbTriangles())) {
-              int aRet = SUIT_MessageBox::warn2
+              int aRet = SUIT_MessageBox::warning
                 (SMESHGUI::desktop(),
                  QObject::tr("SMESH_WRN_WARNING"),
                  QObject::tr("SMESH_EXPORT_STL2").arg(anIObject->getName()),
-                 QObject::tr("SMESH_BUT_YES"),  QObject::tr("SMESH_BUT_NO"),
-                 0, 1, 0);
-              if (aRet)
+                SUIT_MessageBox::Yes | SUIT_MessageBox::No, SUIT_MessageBox::Yes);
+              if (aRet != SUIT_MessageBox::Yes)
                 return;
             }
 
@@ -354,9 +333,9 @@ using namespace std;
             filters.push_back( it.key() );
 
           SUIT_FileDlg* fd = new SUIT_FileDlg( SMESHGUI::desktop(), false, true, true );
-          fd->setCaption( aTitle );
+          fd->setWindowTitle( aTitle );
           fd->setFilters( filters );
-          fd->setSelectedFilter( QObject::tr("STL ASCII  (*.stl)") );
+          fd->selectFilter( QObject::tr("STL ASCII  (*.stl)") );
           bool is_ok = false;
           while (!is_ok) {
             fd->exec();
@@ -374,10 +353,10 @@ using namespace std;
 
           //SUIT_FileDlg* fd = new SUIT_FileDlg( SMESHGUI::desktop(), false, true, true );
           SalomeApp_CheckFileDlg* fd = new SalomeApp_CheckFileDlg
-            ( SMESHGUI::desktop(), false, QObject::tr("SMESH_AUTO_GROUPS") ,true, true );
-          fd->setCaption( aTitle );
+            ( SMESHGUI::desktop(), false, QObject::tr("SMESH_AUTO_GROUPS")true, true );
+          fd->setWindowTitle( aTitle );
           fd->setFilters( filters );
-          fd->setSelectedFilter( QObject::tr("MED 2.2 (*.med)") );
+          fd->selectFilter( QObject::tr("MED 2.2 (*.med)") );
           fd->SetChecked(toCreateGroups);
           bool is_ok = false;
           while (!is_ok) {
@@ -388,13 +367,11 @@ using namespace std;
             if ( !aFilename.isEmpty()
                  && (aMesh->NbPolygons()>0 || aMesh->NbPolyhedrons()>0)
                  && aFormat==SMESH::MED_V2_1) {
-              int aRet = SUIT_MessageBox::warn2(SMESHGUI::desktop(),
-                                                QObject::tr("SMESH_WRN_WARNING"),
-                                                QObject::tr("SMESH_EXPORT_MED_V2_1").arg(anIObject->getName()),
-                                                QObject::tr("SMESH_BUT_YES"),
-                                                QObject::tr("SMESH_BUT_NO"),
-                                                0,1,0);
-              if (aRet) {
+              int aRet = SUIT_MessageBox::warning(SMESHGUI::desktop(),
+                                                 QObject::tr("SMESH_WRN_WARNING"),
+                                                 QObject::tr("SMESH_EXPORT_MED_V2_1").arg(anIObject->getName()),
+                                                 SUIT_MessageBox::Yes | SUIT_MessageBox::No, SUIT_MessageBox::Yes);
+              if (aRet != SUIT_MessageBox::Yes) {
                 is_ok = false;
               }
             }
@@ -410,7 +387,7 @@ using namespace std;
          SUIT_OverrideCursor wc;
 
          try {
-           bool Renumber = false ;
+           bool Renumber = false;
            // PAL 14172  : Check of we have to renumber or not from the preferences before export
            if (resMgr)
              Renumber= resMgr->booleanValue("SMESH","renumbering");
@@ -424,19 +401,19 @@ using namespace std;
            switch ( theCommandID ) {
            case 125:
            case 122:
-             aMesh->ExportToMED( aFilename.latin1(), toCreateGroups, aFormat );
+             aMesh->ExportToMED( aFilename.toLatin1().data(), toCreateGroups, aFormat );
              break;
            case 124:
            case 121:
-             aMesh->ExportDAT( aFilename.latin1() );
+             aMesh->ExportDAT( aFilename.toLatin1().data() );
              break;
            case 126:
            case 123:
-             aMesh->ExportUNV( aFilename.latin1() );
+             aMesh->ExportUNV( aFilename.toLatin1().data() );
              break;
            case 140:
            case 141:
-             aMesh->ExportSTL( aFilename.latin1(), aIsASCII_STL );
+             aMesh->ExportSTL( aFilename.toLatin1().data(), aIsASCII_STL );
              break;
            default:
              break;
@@ -444,10 +421,9 @@ using namespace std;
          }
          catch (const SALOME::SALOME_Exception& S_ex){
            wc.suspend();
-           SUIT_MessageBox::warn1(SMESHGUI::desktop(),
-                                   QObject::tr("SMESH_WRN_WARNING"),
-                                   QObject::tr("SMESH_EXPORT_FAILED"),
-                                   QObject::tr("SMESH_BUT_OK"));
+           SUIT_MessageBox::warning(SMESHGUI::desktop(),
+                                    QObject::tr("SMESH_WRN_WARNING"),
+                                    QObject::tr("SMESH_EXPORT_FAILED"));
            wc.resume();
          }
        }
@@ -473,7 +449,7 @@ using namespace std;
 
     if(selected.Extent() >= 1){
       SALOME_ListIteratorOfListIO It( selected );
-      for(; It.More(); It.Next()){
+      for( ; It.More(); It.Next()){
        Handle(SALOME_InteractiveObject) IObject = It.Value();
        if(IObject->hasEntry()){
          if(SMESH_Actor *anActor = SMESH::FindActorByEntry(IObject->getEntry())){
@@ -500,26 +476,102 @@ using namespace std;
     }
   }
 
-  void SetDisplayMode(int theCommandID){
+  void AutoColor(){
+    SALOME_ListIO selected;
+    SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() );
+    if( !app )
+      return;
+
+    LightApp_SelectionMgr* aSel = app->selectionMgr();
+    SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( app->activeStudy() );
+    if( !aSel || !appStudy )
+      return;
+
+    aSel->selectedObjects( selected );
+    if( selected.IsEmpty() )
+      return;
+
+    Handle(SALOME_InteractiveObject) anIObject = selected.First();
+
+    _PTR(Study) aStudy = appStudy->studyDS();
+    _PTR(SObject) aMainSObject( aStudy->FindObjectID( anIObject->getEntry() ) );
+    SMESH::SMESH_Mesh_var aMainObject = SMESH::IObjectToInterface<SMESH::SMESH_Mesh>(anIObject);
+    if( aMainObject->_is_nil() )
+      return;
+
+    aMainObject->SetAutoColor( true );
+
+    QList<SALOMEDS::Color> aReservedColors;
+
+    SMESH::ListOfGroups aListOfGroups = *aMainObject->GetGroups();
+    for( int i = 0, n = aListOfGroups.length(); i < n; i++ )
+    {
+      SMESH::SMESH_GroupBase_var aGroupObject = aListOfGroups[i];
+      SALOMEDS::Color aCurrentColor = aGroupObject->GetColor();
+
+      SALOMEDS::Color aColor = SMESHGUI::getUniqueColor( aReservedColors );
+      aGroupObject->SetColor( aColor );
+      aReservedColors.append( aColor );
+
+      _PTR(SObject) aGroupSObject = SMESH::FindSObject(aGroupObject);
+      if(SMESH_Actor *anActor = SMESH::FindActorByEntry(aGroupSObject->GetID().c_str()))
+      {
+       if( aGroupObject->GetType() == SMESH::NODE )
+         anActor->SetNodeColor( aColor.R, aColor.G, aColor.B );
+       else if( aGroupObject->GetType() == SMESH::EDGE )
+         anActor->SetEdgeColor( aColor.R, aColor.G, aColor.B );
+       else
+         anActor->SetSufaceColor( aColor.R, aColor.G, aColor.B );
+      }
+    }
+
+    SMESH::RepaintCurrentView();
+  }
+
+  void DisableAutoColor(){
     LightApp_SelectionMgr *aSel = SMESHGUI::selectionMgr();
     SALOME_ListIO selected;
     if( aSel )
       aSel->selectedObjects( selected );
 
+    if(selected.Extent()){
+      Handle(SALOME_InteractiveObject) anIObject = selected.First();
+      SMESH::SMESH_Mesh_var aMesh = SMESH::IObjectToInterface<SMESH::SMESH_Mesh>(anIObject);
+      if ( !aMesh->_is_nil() ) {
+       aMesh->SetAutoColor( false );
+      }
+    }
+  }
+
+  void SetDisplayMode(int theCommandID){
+    SALOME_ListIO selected;
+    SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() );
+    if( !app )
+      return;
+
+    LightApp_SelectionMgr *aSel = SMESHGUI::selectionMgr();
+    SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( app->activeStudy() );
+    if( !aSel || !appStudy )
+      return;
+
+    _PTR(Study) aStudy = appStudy->studyDS();
+
+    aSel->selectedObjects( selected );
+
     if(selected.Extent() >= 1){
       switch(theCommandID){
       case 1134:{
        SMESHGUI::GetSMESHGUI()->EmitSignalDeactivateDialog();
-       new SMESHGUI_ClippingDlg( SMESHGUI::GetSMESHGUI(), "", false );
+       (new SMESHGUI_ClippingDlg( SMESHGUI::GetSMESHGUI() ))->show();
        return;
       }
       case 1133:{
        SMESHGUI::GetSMESHGUI()->EmitSignalDeactivateDialog();
-       new SMESHGUI_TransparencyDlg( SMESHGUI::GetSMESHGUI(), "", false );
+       (new SMESHGUI_TransparencyDlg( SMESHGUI::GetSMESHGUI() ))->show();
        return;
       }}
       SALOME_ListIteratorOfListIO It( selected );
-      for(; It.More(); It.Next()){
+      for( ; It.More(); It.Next()){
        Handle(SALOME_InteractiveObject) IObject = It.Value();
        if(IObject->hasEntry()){
          if(SMESH_Actor *anActor = SMESH::FindActorByEntry(IObject->getEntry())){
@@ -575,7 +627,7 @@ using namespace std;
              vtkFloatingPointType Shrink = anActor->GetShrinkFactor();
 
              SMESHGUI_Preferences_ColorDlg *aDlg =
-               new SMESHGUI_Preferences_ColorDlg( SMESHGUI::GetSMESHGUI(), "" );
+               new SMESHGUI_Preferences_ColorDlg( SMESHGUI::GetSMESHGUI() );
              aDlg->SetColor(1, c);
              aDlg->SetColor(2, e);
              aDlg->SetColor(3, n);
@@ -611,6 +663,16 @@ using namespace std;
                                      vtkFloatingPointType (nodecolor.blue()) / 255.);
                anActor->SetNodeSize(aDlg->GetIntValue(2));
 
+               SMESH::SMESH_GroupBase_var aGroupObject = SMESH::IObjectToInterface<SMESH::SMESH_GroupBase>(IObject);
+               if( !aGroupObject->_is_nil() )
+               {
+                 SALOMEDS::Color aColor;
+                 aColor.R = (float)color.red() / 255.0;
+                 aColor.G = (float)color.green() / 255.0;
+                 aColor.B = (float)color.blue() / 255.0;
+                 aGroupObject->SetColor( aColor );
+               }
+
                delete aDlg;
              }
              break;
@@ -694,7 +756,7 @@ using namespace std;
            break;
          }
          anActor->SetControlMode(aControl);
-         anActor->GetScalarBarActor()->SetTitle(aTitle.latin1());
+         anActor->GetScalarBarActor()->SetTitle(aTitle.toLatin1().data());
          SMESH::RepaintCurrentView();
        }
       }
@@ -757,7 +819,7 @@ using namespace std;
 
     QString RefType = CheckTypeObject(selected.First());
     SALOME_ListIteratorOfListIO It(selected);
-    for (; It.More(); It.Next())
+    for ( ; It.More(); It.Next())
       {
        Handle(SALOME_InteractiveObject) IObject = It.Value();
        QString Type = CheckTypeObject(IObject);
@@ -786,18 +848,18 @@ using namespace std;
     }
 
     if ( aParentComponent != SMESHGUI::GetSMESHGUI()->name() )  {
-      SUIT_MessageBox::warn1 ( SMESHGUI::desktop(),
-                             QObject::tr("ERR_ERROR"),
-                             QObject::tr("NON_SMESH_OBJECTS_SELECTED").arg( SMESHGUI::GetSMESHGUI()->moduleName() ),
-                             QObject::tr("BUT_OK") );
+      SUIT_MessageBox::warning( SMESHGUI::desktop(),
+                               QObject::tr("ERR_ERROR"),
+                               QObject::tr("NON_SMESH_OBJECTS_SELECTED").arg( SMESHGUI::GetSMESHGUI()->moduleName() ) );
       return;
     }
     // VSR 17/11/04: check if all objects selected belong to SMESH component <-- finish
-    if (SUIT_MessageBox::warn2
+    if (SUIT_MessageBox::warning
        (SMESHGUI::desktop(),
         QObject::tr("SMESH_WRN_WARNING"),
         QObject::tr("SMESH_REALLY_DELETE"),
-        QObject::tr("SMESH_BUT_YES"), QObject::tr("SMESH_BUT_NO"), 1, 0, 0) != 1)
+        SUIT_MessageBox::Yes | SUIT_MessageBox::No, 
+        SUIT_MessageBox::Yes) != SUIT_MessageBox::Yes)
       return;
 
     SalomeApp_Application* anApp = dynamic_cast<SalomeApp_Application*>( SUIT_Session::session()->activeApplication() );
@@ -812,7 +874,7 @@ using namespace std;
     SALOME_ListIteratorOfListIO It(selected);
 
     aStudyBuilder->NewCommand();  // There is a transaction
-    for(; It.More(); It.Next()){ // loop on selected IO's
+    for( ; It.More(); It.Next()){ // loop on selected IO's
       Handle(SALOME_InteractiveObject) IObject = It.Value();
       if(IObject->hasEntry()) {
        _PTR(SObject) aSO = aStudy->FindObjectID(IObject->getEntry());
@@ -820,7 +882,7 @@ using namespace std;
        // disable removal of "SMESH" component object
        if(aSO->FindAttribute(anAttr, "AttributeIOR")){
          anIOR = anAttr;
-         if ( !strcmp( (char*)anIOR->Value().c_str(), engineIOR().latin1() ) )
+         if ( engineIOR() == anIOR->Value().c_str() )
            continue;
        }
 
@@ -846,7 +908,7 @@ using namespace std;
 
           /** Erase graphical object **/
          if(SO->FindAttribute(anAttr, "AttributeIOR")){
-           QPtrVector<SUIT_ViewWindow> aViews = vm->getViews();
+           QVector<SUIT_ViewWindow*> aViews = vm->getViews();
            for(int i = 0; i < nbSf; i++){
              SUIT_ViewWindow *sf = aViews[i];
              if(SMESH_Actor* anActor = SMESH::FindActorByEntry(sf,anEntry.c_str())){
@@ -872,7 +934,7 @@ using namespace std;
           }
           else {
             IObject = new SALOME_InteractiveObject
-              ( anEntry.c_str(), engineIOR().latin1(), SO->GetName().c_str() );
+              ( anEntry.c_str(), engineIOR().toLatin1().data(), SO->GetName().c_str() );
             QString objType = CheckTypeObject(IObject);
             if ( objType == "Hypothesis" || objType == "Algorithm" ) {// DELETE HYPOTHESIS
               SMESH::RemoveHypothesisOrAlgorithmOnMesh(IObject);
@@ -1141,10 +1203,9 @@ static int isStudyLocked(_PTR(Study) theStudy){
 
 static bool checkLock(_PTR(Study) theStudy) {
   if (isStudyLocked(theStudy)) {
-    SUIT_MessageBox::warn1 ( SMESHGUI::desktop(),
-                          QObject::tr("WRN_WARNING"),
-                          QObject::tr("WRN_STUDY_LOCKED"),
-                          QObject::tr("BUT_OK") );
+    SUIT_MessageBox::warning( SMESHGUI::desktop(),
+                             QObject::tr("WRN_WARNING"),
+                             QObject::tr("WRN_STUDY_LOCKED") );
     return true;
   }
   return false;
@@ -1237,6 +1298,15 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
       break;
     }
 
+    // Auto-color
+  case 1136:
+    ::AutoColor();
+  break;
+
+  case 1137:
+    ::DisableAutoColor();
+  break;
+
   case 1134: // Clipping
   case 1133: // Tranparency
   case 1132: // Colors / Size
@@ -1260,7 +1330,18 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
   case 214:                                    // UPDATE
     {
       if(checkLock(aStudy)) break;
-      SMESH::UpdateView();
+      try {
+#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
+        OCC_CATCH_SIGNALS;
+#endif
+        SMESH::UpdateView();
+      }
+      catch (std::bad_alloc) { // PAL16774 (Crash after display of many groups)
+        SMESH::OnVisuException();
+      }
+      catch (...) { // PAL16774 (Crash after display of many groups)
+        SMESH::OnVisuException();
+      }
 
       SALOME_ListIO l;
       LightApp_SelectionMgr *aSel = SMESHGUI::selectionMgr();
@@ -1290,22 +1371,31 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
 
       extractContainers( sel_objects, to_process );
 
-      if (vtkwnd) {
-       SALOME_ListIteratorOfListIO It( to_process );
-       for (; It.More(); It.Next()) {
-         Handle(SALOME_InteractiveObject) IOS = It.Value();
-         if (IOS->hasEntry()) {
-            SMESH::UpdateView(anAction, IOS->getEntry());
-            if (anAction == SMESH::eDisplayOnly)
-              anAction = SMESH::eDisplay;
-         }
-       }
-      }
+      try {
+#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
+        OCC_CATCH_SIGNALS;
+#endif
+        if (vtkwnd) {
+          SALOME_ListIteratorOfListIO It( to_process );
+          for ( ; It.More(); It.Next()) {
+            Handle(SALOME_InteractiveObject) IOS = It.Value();
+            if (IOS->hasEntry()) {
+              if (!SMESH::UpdateView(anAction, IOS->getEntry()))
+                break; // PAL16774 (Crash after display of many groups)
+              if (anAction == SMESH::eDisplayOnly)
+                anAction = SMESH::eDisplay;
+            }
+          }
+        }
 
-      // PAL13338 + PAL15161 -->
-      if ( ( theCommandID==301 || theCommandID==302 ) && !checkLock(aStudy) /*&& !automaticUpdate()*/ )
-       SMESH::UpdateView();
-      // PAL13338 + PAL15161 <--
+        // PAL13338 + PAL15161 -->
+        if ( ( theCommandID==301 || theCommandID==302 ) && !checkLock(aStudy))
+          SMESH::UpdateView();
+        // PAL13338 + PAL15161 <--
+      }
+      catch (...) { // PAL16774 (Crash after display of many groups)
+        SMESH::OnVisuException();
+      }
 
       if (anAction == SMESH::eErase) {
        SALOME_ListIO l1;
@@ -1324,13 +1414,12 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
       if ( vtkwnd ) {
        EmitSignalDeactivateDialog();
 
-       new SMESHGUI_NodesDlg(this);
+       ( new SMESHGUI_NodesDlg( this ) )->show();
       }
       else {
-       SUIT_MessageBox::warn1(desktop(),
-                             tr("SMESH_WRN_WARNING"),
-                             tr("SMESH_WRN_VIEWER_VTK"),
-                             tr("SMESH_BUT_OK"));
+       SUIT_MessageBox::warning(desktop(),
+                                tr("SMESH_WRN_WARNING"),
+                                tr("SMESH_WRN_VIEWER_VTK"));
       }
       break;
     }
@@ -1340,7 +1429,7 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
     if ( vtkwnd )
     {
       EmitSignalDeactivateDialog();
-      new SMESHGUI_FilterDlg( this, SMESH::EDGE );
+      ( new SMESHGUI_FilterDlg( this, SMESH::EDGE ) )->show();
     }
     break;
   }
@@ -1349,13 +1438,13 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
     {
       if ( !vtkwnd )
       {
-        SUIT_MessageBox::warn1( desktop(), tr( "SMESH_WRN_WARNING" ),
-          tr( "NOT_A_VTK_VIEWER" ),tr( "SMESH_BUT_OK" ) );
+        SUIT_MessageBox::warning( desktop(), tr( "SMESH_WRN_WARNING" ),
+                                 tr( "NOT_A_VTK_VIEWER" ) );
         break;
       }
 
       if(checkLock(aStudy)) break;
-      new SMESHGUI_MoveNodesDlg(this);
+      ( new SMESHGUI_MoveNodesDlg( this ) )->show();
       break;
     }
 
@@ -1364,82 +1453,6 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
       if (checkLock(aStudy)) break;
 
       startOperation( 701 );
-//       LightApp_SelectionMgr *Sel = selectionMgr();
-//       SALOME_ListIO selected; Sel->selectedObjects( selected );
-
-//       int nbSel = selected.Extent();
-//       if (nbSel != 1) {
-//         SUIT_MessageBox::warn1(desktop(),
-//                                tr("SMESH_WRN_WARNING"),
-//                                tr("SMESH_WRN_NO_AVAILABLE_DATA"),
-//                                tr("SMESH_BUT_OK"));
-//         break;
-//       }
-
-//       SMESH::SMESH_Mesh_var aMesh;
-//       SMESH::SMESH_subMesh_var aSubMesh;
-//       Handle(SALOME_InteractiveObject) IObject = selected.First();
-//       if (IObject->hasEntry()) {
-//         _PTR(SObject) aMeshSObj = aStudy->FindObjectID(IObject->getEntry());
-//         GEOM::GEOM_Object_var aShapeObject = SMESH::GetShapeOnMeshOrSubMesh( aMeshSObj );
-//         if ( aShapeObject->_is_nil() ) {
-//           // imported mesh
-//           break;
-//         }
-//         if ( aMeshSObj ) {
-//           aMesh = SMESH::SObjectToInterface<SMESH::SMESH_Mesh>(aMeshSObj);
-//           aSubMesh = SMESH::SObjectToInterface<SMESH::SMESH_subMesh>(aMeshSObj);
-//           if ( !aSubMesh->_is_nil() )
-//             aMesh = aSubMesh->GetFather();
-
-//           if (!aMesh->_is_nil()) {
-//             SMESH::algo_error_array_var errors = GetSMESHGen()->GetAlgoState(aMesh,aShapeObject);
-//             if ( errors->length() > 0 ) {
-//               SUIT_MessageBox::warn1(desktop(),
-//                                      tr("SMESH_WRN_WARNING"),
-//                                      SMESH::GetMessageOnAlgoStateErrors( errors.in() ),
-//                                      tr("SMESH_BUT_OK"));
-//               break;
-//             }
-
-//             try {
-//               if (GetSMESHGen()->Compute(aMesh, aShapeObject))
-//                 SMESH::ModifiedMesh(aMeshSObj, true);
-//               else
-//                 SUIT_MessageBox::warn1(desktop(),
-//                                        tr("SMESH_WRN_WARNING"),
-//                                        tr("SMESH_WRN_COMPUTE_FAILED"),
-//                                        tr("SMESH_BUT_OK"));
-//             }
-//             catch(const SALOME::SALOME_Exception & S_ex){
-//               SalomeApp_Tools::QtCatchCorbaException(S_ex);
-//             }
-
-//             updateObjBrowser();
-
-//             if (automaticUpdate()) {
-//               SVTK_ViewWindow* aVTKView = SMESH::GetViewWindow(this, /*create*/true);
-//               if (aVTKView) {
-//                 CORBA::Long anId = aStudy->StudyId();
-//                 TVisualObjPtr aVisualObj = SMESH::GetVisualObj(anId, IObject->getEntry());
-//                 if (aVisualObj) {
-//                   aVisualObj->Update();
-//                   SMESH_Actor* anActor = SMESH::FindActorByEntry(IObject->getEntry());
-//                   if (!anActor) {
-//                     anActor = SMESH::CreateActor(aStudy, IObject->getEntry());
-//                     if (anActor) {
-//                       SMESH::DisplayActor(aVTKView, anActor); //apo
-//                       SMESH::FitAll();
-//                     }
-//                   }
-//                   SMESH::RepaintCurrentView();
-//                   Sel->setSelectedObjects( selected );
-//                 }
-//               }
-//             }
-//           }
-//         }
-//       }
     }
     break;
 
@@ -1456,7 +1469,7 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
     {
       if (checkLock(aStudy)) break;
       EmitSignalDeactivateDialog();
-      new SMESHGUI_BuildCompoundDlg( this );
+      ( new SMESHGUI_BuildCompoundDlg( this ) )->show();
     }
     break;
   case 407: // DIAGONAL INVERSION
@@ -1464,8 +1477,8 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
     {
       if ( !vtkwnd )
       {
-        SUIT_MessageBox::warn1( desktop(), tr( "SMESH_WRN_WARNING" ),
-          tr( "NOT_A_VTK_VIEWER" ),tr( "SMESH_BUT_OK" ) );
+        SUIT_MessageBox::warning( desktop(), tr( "SMESH_WRN_WARNING" ),
+                                 tr( "NOT_A_VTK_VIEWER" ) );
         break;
       }
 
@@ -1476,16 +1489,16 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
       SMESH::SMESH_Mesh_var aMesh = SMESH::IObjectToInterface<SMESH::SMESH_Mesh>(IObject);
       if ( aMesh->_is_nil() )
       {
-        SUIT_MessageBox::warn1(GetDesktop(), tr( "SMESH_WRN_WARNING" ),
-          tr( "SMESH_BAD_SELECTION" ), tr( "SMESH_BUT_OK" ) );
+        SUIT_MessageBox::warning(GetDesktop(), tr( "SMESH_WRN_WARNING" ),
+          tr( "SMESH_BAD_SELECTION" ) );
         break;
       }
       */
       EmitSignalDeactivateDialog();
       if ( theCommandID == 407 )
-        new SMESHGUI_TrianglesInversionDlg(this);
+        ( new SMESHGUI_TrianglesInversionDlg( this ) )->show();
       else
-        new SMESHGUI_UnionOfTwoTrianglesDlg(this);
+        ( new SMESHGUI_UnionOfTwoTrianglesDlg( this ) )->show();
       break;
     }
     case 409: // Change orientation
@@ -1494,8 +1507,8 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
     {
       if ( !vtkwnd )
       {
-        SUIT_MessageBox::warn1( desktop(), tr( "SMESH_WRN_WARNING" ),
-          tr( "NOT_A_VTK_VIEWER" ),tr( "SMESH_BUT_OK" ) );
+        SUIT_MessageBox::warning( desktop(), tr( "SMESH_WRN_WARNING" ),
+                                 tr( "NOT_A_VTK_VIEWER" ) );
         break;
       }
 
@@ -1519,12 +1532,11 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
       if(checkLock(aStudy)) break;
       if( vtkwnd ) {
        EmitSignalDeactivateDialog();
-       new SMESHGUI_SmoothingDlg( this );
+       ( new SMESHGUI_SmoothingDlg( this ) )->show();
       }
       else {
-       SUIT_MessageBox::warn1(desktop(),
-                             tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"),
-                             tr("SMESH_BUT_OK"));
+       SUIT_MessageBox::warning(desktop(),
+                                tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"));
       }
       break;
     }
@@ -1533,11 +1545,10 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
       if (checkLock(aStudy)) break;
       if (vtkwnd) {
        EmitSignalDeactivateDialog();
-       new SMESHGUI_ExtrusionDlg ( this );
+       ( new SMESHGUI_ExtrusionDlg ( this ) )->show();
       } else {
-       SUIT_MessageBox::warn1(desktop(),
-                               tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"),
-                               tr("SMESH_BUT_OK"));
+       SUIT_MessageBox::warning(desktop(),
+                                tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"));
       }
       break;
     }
@@ -1546,12 +1557,11 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
       if(checkLock(aStudy)) break;
       if( vtkwnd ) {
        EmitSignalDeactivateDialog();
-       new SMESHGUI_RevolutionDlg( this );
+       ( new SMESHGUI_RevolutionDlg( this ) )->show();
       }
       else {
-       SUIT_MessageBox::warn1(desktop(),
-                             tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"),
-                             tr("SMESH_BUT_OK"));
+       SUIT_MessageBox::warning(desktop(),
+                                tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"));
       }
       break;
     }
@@ -1562,12 +1572,11 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
       if ( vtkwnd )
       {
         EmitSignalDeactivateDialog();
-        new SMESHGUI_MeshPatternDlg( this );
+        ( new SMESHGUI_MeshPatternDlg( this ) )->show();
       }
       else {
-       SUIT_MessageBox::warn1(desktop(),
-                             tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"),
-                             tr("SMESH_BUT_OK"));
+       SUIT_MessageBox::warning(desktop(),
+                                tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"));
       }
       break;
     }
@@ -1576,11 +1585,10 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
       if (checkLock(aStudy)) break;
       if (vtkwnd) {
        EmitSignalDeactivateDialog();
-       new SMESHGUI_ExtrusionAlongPathDlg( this );
+       ( new SMESHGUI_ExtrusionAlongPathDlg( this ) )->show();
       } else {
-       SUIT_MessageBox::warn1(desktop(),
-                               tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"),
-                               tr("SMESH_BUT_OK"));
+       SUIT_MessageBox::warning(desktop(),
+                                tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"));
       }
       break;
     }
@@ -1592,9 +1600,8 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
        EmitSignalDeactivateDialog();
        new SMESHGUI_ConvToQuadDlg();
       } else {
-       SUIT_MessageBox::warn1(desktop(),
-                               tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"),
-                               tr("SMESH_BUT_OK"));
+       SUIT_MessageBox::warning(desktop(),
+                               tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"));
                               }*/
       break;
     }
@@ -1602,8 +1609,8 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
     {
       if ( !vtkwnd )
       {
-        SUIT_MessageBox::warn1( desktop(), tr( "SMESH_WRN_WARNING" ),
-          tr( "NOT_A_VTK_VIEWER" ),tr( "SMESH_BUT_OK" ) );
+        SUIT_MessageBox::warning( desktop(), tr( "SMESH_WRN_WARNING" ),
+                                 tr( "NOT_A_VTK_VIEWER" ) );
         break;
       }
 
@@ -1621,7 +1628,7 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
        // check if mesh is selected
         aMesh = SMESH::GetMeshByIO( selected.First() );
       }
-      SMESHGUI_GroupDlg *aDlg = new SMESHGUI_GroupDlg( this, "", aMesh);
+      SMESHGUI_GroupDlg *aDlg = new SMESHGUI_GroupDlg( this, aMesh);
       aDlg->show();
       break;
     }
@@ -1630,8 +1637,8 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
     {
       if ( !vtkwnd )
       {
-        SUIT_MessageBox::warn1( desktop(), tr( "SMESH_WRN_WARNING" ),
-          tr( "NOT_A_VTK_VIEWER" ),tr( "SMESH_BUT_OK" ) );
+        SUIT_MessageBox::warning( desktop(), tr( "SMESH_WRN_WARNING" ),
+                                 tr( "NOT_A_VTK_VIEWER" ) );
         break;
       }
 
@@ -1688,10 +1695,9 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
        }
       }
       else if(nbSel==0) {
-        SUIT_MessageBox::warn1(desktop(),
-                               tr("SMESH_WRN_WARNING"),
-                               tr("SMESH_WRN_NO_AVAILABLE_DATA"),
-                               tr("SMESH_BUT_OK"));
+        SUIT_MessageBox::warning(desktop(),
+                                tr("SMESH_WRN_WARNING"),
+                                tr("SMESH_WRN_NO_AVAILABLE_DATA"));
       }
       break;
     }
@@ -1700,8 +1706,8 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
     {
       if ( !vtkwnd )
       {
-        SUIT_MessageBox::warn1( desktop(), tr( "SMESH_WRN_WARNING" ),
-          tr( "NOT_A_VTK_VIEWER" ),tr( "SMESH_BUT_OK" ) );
+        SUIT_MessageBox::warning( desktop(), tr( "SMESH_WRN_WARNING" ),
+                                 tr( "NOT_A_VTK_VIEWER" ) );
         break;
       }
 
@@ -1721,13 +1727,13 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
           SMESH::IObjectToInterface<SMESH::SMESH_GroupBase>(It.Value());
         if (!aGroup->_is_nil()) {
          nbSelectedGroups++;
-          SMESHGUI_GroupDlg *aDlg = new SMESHGUI_GroupDlg( this, "", aGroup);
+          SMESHGUI_GroupDlg *aDlg = new SMESHGUI_GroupDlg( this, aGroup);
           aDlg->show();
        }
       }
       if (nbSelectedGroups == 0)
        {
-         SMESHGUI_GroupDlg *aDlg = new SMESHGUI_GroupDlg( this, "", SMESH::SMESH_GroupBase::_nil());
+         SMESHGUI_GroupDlg *aDlg = new SMESHGUI_GroupDlg( this, SMESH::SMESH_GroupBase::_nil());
          aDlg->show();
        }
       break;
@@ -1759,8 +1765,8 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
     {
       if ( !vtkwnd )
       {
-        SUIT_MessageBox::warn1( desktop(), tr( "SMESH_WRN_WARNING" ),
-          tr( "NOT_A_VTK_VIEWER" ),tr( "SMESH_BUT_OK" ) );
+        SUIT_MessageBox::warning( desktop(), tr( "SMESH_WRN_WARNING" ),
+                                 tr( "NOT_A_VTK_VIEWER" ) );
         break;
       }
 
@@ -1782,8 +1788,8 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
     {
       if ( !vtkwnd )
       {
-        SUIT_MessageBox::warn1( desktop(), tr( "SMESH_WRN_WARNING" ),
-          tr( "NOT_A_VTK_VIEWER" ),tr( "SMESH_BUT_OK" ) );
+        SUIT_MessageBox::warning( desktop(), tr( "SMESH_WRN_WARNING" ),
+                                 tr( "NOT_A_VTK_VIEWER" ) );
         break;
       }
 
@@ -1792,7 +1798,7 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
 
       EmitSignalDeactivateDialog();
 
-      new SMESHGUI_DeleteGroupDlg( this );
+      ( new SMESHGUI_DeleteGroupDlg( this ) )->show();
       break;
     }
 
@@ -1810,13 +1816,13 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
         for ( ; It.More(); It.Next() ) {
          IOs.Clear(); IOs.Append( It.Value() );
          aSel->setSelectedObjects( IOs );
-          new SMESHGUI_MeshInfosDlg(this, "", false);
+          ( new SMESHGUI_MeshInfosDlg( this ) )->show();
         }
         // restore selection
         aSel->setSelectedObjects( selected );
       }
       else
-        new SMESHGUI_MeshInfosDlg(this, "", false);
+        ( new SMESHGUI_MeshInfosDlg( this ) )->show();
       break;
     }
 
@@ -1835,13 +1841,20 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
          IOs.Clear();
          IOs.Append( It.Value() );
          aSel->setSelectedObjects( IOs );
-          new SMESHGUI_StandardMeshInfosDlg( this, "", false);
+          ( new SMESHGUI_StandardMeshInfosDlg( this ) )->show();
         }
         // restore selection
        aSel->setSelectedObjects( selected );
       }
       else
-        new SMESHGUI_StandardMeshInfosDlg( this, "", false);
+        ( new SMESHGUI_StandardMeshInfosDlg( this ) )->show();
+      break;
+    }
+
+  case 903:                                    // WHAT IS
+    {
+      EmitSignalDeactivateDialog();
+      ( new SMESHGUI_WhatIsDlg( this ) )->show();
       break;
     }
 
@@ -1857,17 +1870,17 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
       int nbSel = selected.Extent();
 
       if (nbSel == 1) {
-       SMESH::SMESH_Hypothesis_var Hyp = SMESH::IObjectToInterface<SMESH::SMESH_Hypothesis>(selected.First());
+        Handle(SALOME_InteractiveObject) anIObject = selected.First();
+       SMESH::SMESH_Hypothesis_var aHypothesis = SMESH::IObjectToInterface<SMESH::SMESH_Hypothesis>(anIObject);
 
         /* Look for all mesh objects that have this hypothesis affected in order to flag as ModifiedMesh */
         /* At end below '...->updateObjBrowser(true)' will change icon of mesh objects                   */
         /* Warning : however by internal mechanism all subMeshes icons are changed !                     */
-        if ( !Hyp->_is_nil() )
+        if ( !aHypothesis->_is_nil() )
         {
-          char* sName = Hyp->GetName();
-          SMESHGUI_GenericHypothesisCreator* aCreator = SMESH::GetHypothesisCreator(sName);
+          SMESHGUI_GenericHypothesisCreator* aCreator = SMESH::GetHypothesisCreator(aHypothesis->GetName());
           if (aCreator)
-            aCreator->edit( Hyp.in(), desktop() );
+            aCreator->edit( aHypothesis.in(), anIObject->getName(), desktop() );
           else
           {
             // report error
@@ -1905,13 +1918,13 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
             if ( !newName.isEmpty() )
             {
               //old source: aStudy->renameIObject( IObject, newName );
-             aName->SetValue( newName.latin1() );
+             aName->SetValue( newName.toLatin1().data() );
 
               // if current object is group update group's name
              SMESH::SMESH_GroupBase_var aGroup =
                 SMESH::IObjectToInterface<SMESH::SMESH_GroupBase>(IObject);
               if (!aGroup->_is_nil() )
-                aGroup->SetName( newName.latin1() );
+                aGroup->SetName( newName.toLatin1().data() );
 
              updateObjBrowser();
             }
@@ -1969,12 +1982,11 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
          type = SMDSAbs_Volume; nbNodes = 9; break; // 9 - identificator for POLYHEDRE
         default:;
         }
-       new SMESHGUI_AddMeshElementDlg( this, "", type, nbNodes);
+       ( new SMESHGUI_AddMeshElementDlg( this, type, nbNodes ) )->show();
       }
       else {
-       SUIT_MessageBox::warn1(desktop(),
-                             tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"),
-                             tr("SMESH_BUT_OK"));
+       SUIT_MessageBox::warning(desktop(),
+                                tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"));
       }
       break;
     }
@@ -1983,12 +1995,11 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
       if(checkLock(aStudy)) break;
       if ( vtkwnd ) {
        EmitSignalDeactivateDialog();
-       new SMESHGUI_CreatePolyhedralVolumeDlg(this, "", FALSE );
+       ( new SMESHGUI_CreatePolyhedralVolumeDlg( this ) )->show();
       }
       else {
-       SUIT_MessageBox::warn1(SMESHGUI::desktop(),
-                             tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"),
-                             tr("SMESH_BUT_OK"));
+       SUIT_MessageBox::warning(SMESHGUI::desktop(),
+                                tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"));
       }
       break;
     }
@@ -2023,12 +2034,11 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
          break;
        default:;
        }
-        new SMESHGUI_AddQuadraticElementDlg( this, type );
+        ( new SMESHGUI_AddQuadraticElementDlg( this, type ) )->show();
       }
       else {
-       SUIT_MessageBox::warn1(SMESHGUI::desktop(),
-                              tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"),
-                              tr("SMESH_BUT_OK"));
+       SUIT_MessageBox::warning(SMESHGUI::desktop(),
+                                tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"));
       }
       break;
     }
@@ -2037,12 +2047,11 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
       if(checkLock(aStudy)) break;
       if ( vtkwnd ) {
        EmitSignalDeactivateDialog();
-       new SMESHGUI_RemoveNodesDlg(this);
+       ( new SMESHGUI_RemoveNodesDlg( this ) )->show();
       }
       else {
-       SUIT_MessageBox::warn1(desktop(),
-                             tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"),
-                             tr("SMESH_BUT_OK"));
+       SUIT_MessageBox::warning(SMESHGUI::desktop(),
+                                tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"));
       }
       break;
     }
@@ -2051,13 +2060,12 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
       if(checkLock(aStudy)) break;
       if( vtkwnd ) {
        EmitSignalDeactivateDialog();
-       new SMESHGUI_RemoveElementsDlg(this);
+       ( new SMESHGUI_RemoveElementsDlg( this ) )->show();
       }
       else
        {
-         SUIT_MessageBox::warn1(desktop(),
-                               tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"),
-                               tr("SMESH_BUT_OK"));
+         SUIT_MessageBox::warning(SMESHGUI::desktop(),
+                                  tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"));
        }
       break;
     }
@@ -2066,13 +2074,12 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
       if(checkLock(aStudy)) break;
       if( vtkwnd ) {
        EmitSignalDeactivateDialog();
-       new SMESHGUI_RenumberingDlg( this, "", 0);
+       ( new SMESHGUI_RenumberingDlg( this, 0 ) )->show();
       }
       else
        {
-         SUIT_MessageBox::warn1(desktop(),
-                               tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"),
-                               tr("SMESH_BUT_OK"));
+         SUIT_MessageBox::warning(SMESHGUI::desktop(),
+                                  tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"));
        }
       break;
     }
@@ -2081,13 +2088,12 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
       if(checkLock(aStudy)) break;
       if ( vtkwnd ) {
        EmitSignalDeactivateDialog();
-       new SMESHGUI_RenumberingDlg( this, "", 1);
+       ( new SMESHGUI_RenumberingDlg( this, 1 ) )->show();
       }
       else
        {
-         SUIT_MessageBox::warn1(desktop(),
-                               tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"),
-                               tr("SMESH_BUT_OK"));
+         SUIT_MessageBox::warning(SMESHGUI::desktop(),
+                                  tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"));
        }
       break;
     }
@@ -2096,12 +2102,11 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
       if(checkLock(aStudy)) break;
       if ( vtkwnd ) {
        EmitSignalDeactivateDialog();
-       new SMESHGUI_TranslationDlg( this );
+       ( new SMESHGUI_TranslationDlg( this ) )->show();
       }
       else {
-       SUIT_MessageBox::warn1(desktop(),
-                             tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"),
-                             tr("SMESH_BUT_OK"));
+       SUIT_MessageBox::warning(SMESHGUI::desktop(),
+                                tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"));
       }
       break;
     }
@@ -2110,12 +2115,11 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
       if(checkLock(aStudy)) break;
       if( vtkwnd ) {
        EmitSignalDeactivateDialog();
-       new SMESHGUI_RotationDlg( this );
+       ( new SMESHGUI_RotationDlg( this ) )->show();
       }
       else {
-       SUIT_MessageBox::warn1(desktop(),
-                             tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"),
-                             tr("SMESH_BUT_OK"));
+       SUIT_MessageBox::warning(SMESHGUI::desktop(),
+                                tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"));
       }
       break;
     }
@@ -2124,12 +2128,11 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
       if(checkLock(aStudy)) break;
       if(vtkwnd) {
        EmitSignalDeactivateDialog();
-       new SMESHGUI_SymmetryDlg( this );
+       ( new SMESHGUI_SymmetryDlg( this ) )->show();
       }
       else {
-       SUIT_MessageBox::warn1(desktop(),
-                             tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"),
-                             tr("SMESH_BUT_OK"));
+       SUIT_MessageBox::warning(SMESHGUI::desktop(),
+                                tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"));
       }
       break;
     }
@@ -2138,12 +2141,11 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
       if(checkLock(aStudy)) break;
       if(vtkwnd) {
        EmitSignalDeactivateDialog();
-       new SMESHGUI_SewingDlg( this );
+       ( new SMESHGUI_SewingDlg( this ) )->show();
       }
       else {
-       SUIT_MessageBox::warn1(desktop(),
-                             tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"),
-                             tr("SMESH_BUT_OK"));
+       SUIT_MessageBox::warning(SMESHGUI::desktop(),
+                                tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"));
       }
       break;
     }
@@ -2152,12 +2154,11 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
       if(checkLock(aStudy)) break;
       if(vtkwnd) {
        EmitSignalDeactivateDialog();
-       new SMESHGUI_EditMeshDlg( this, 0 );
+       ( new SMESHGUI_EditMeshDlg( this, 0 ) )->show();
       }
       else {
-       SUIT_MessageBox::warn1(desktop(),
-                             tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"),
-                             tr("SMESH_BUT_OK"));
+       SUIT_MessageBox::warning(SMESHGUI::desktop(),
+                                tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"));
       }
       break;
     }
@@ -2166,11 +2167,10 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
       if (checkLock(aStudy)) break;
       if (vtkwnd) {
        EmitSignalDeactivateDialog();
-       new SMESHGUI_EditMeshDlg( this, 1 );
+       ( new SMESHGUI_EditMeshDlg( this, 1 ) )->show();
       } else {
-       SUIT_MessageBox::warn1(desktop(),
-                             tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"),
-                             tr("SMESH_BUT_OK"));
+       SUIT_MessageBox::warning(SMESHGUI::desktop(),
+                                tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"));
       }
       break;
     }
@@ -2181,7 +2181,7 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
 
   case 5105: // Library of selection filters
   {
-    static QValueList<int> aTypes;
+    static QList<int> aTypes;
     if ( aTypes.isEmpty() )
     {
       aTypes.append( SMESH::NODE );
@@ -2229,17 +2229,15 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
          }
        }
       }
-      SUIT_MessageBox::warn1(desktop(),
-                           tr( "SMESH_WRN_WARNING" ),
-                           tr( "SMESH_BAD_SELECTION" ),
-                           tr( "SMESH_BUT_OK" ) );
+      SUIT_MessageBox::warning(desktop(),
+                              tr( "SMESH_WRN_WARNING" ),
+                              tr( "SMESH_BAD_SELECTION" ) );
       break;
     }
     else {
-      SUIT_MessageBox::warn1(desktop(),
-                           tr( "SMESH_WRN_WARNING" ),
-                           tr( "NOT_A_VTK_VIEWER" ),
-                           tr( "SMESH_BUT_OK" ) );
+      SUIT_MessageBox::warning(desktop(),
+                              tr( "SMESH_WRN_WARNING" ),
+                              tr( "NOT_A_VTK_VIEWER" ) );
     }
     break;
   case 9010:
@@ -2248,7 +2246,7 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
       SALOME_ListIO selected; mgr->selectedObjects( selected );
 
       SALOME_ListIteratorOfListIO it(selected);
-      for(; it.More(); it.Next()) {
+      for( ; it.More(); it.Next()) {
         Handle(SALOME_InteractiveObject) anIObject = it.Value();
        if(anIObject->hasEntry()) {
          if(SMESH_Actor *anActor = SMESH::FindActorByEntry(anIObject->getEntry())){
@@ -2329,20 +2327,20 @@ void SMESHGUI::BuildPresentation( const Handle(SALOME_InteractiveObject) & theIO
 //=======================================================================
 void SMESHGUI::createSMESHAction( const int id, const QString& po_id, const QString& icon_id, const int key, const bool toggle  )
 {
-  QIconSet icon;
+  QIcon icon;
   QWidget* parent = application()->desktop();
   SUIT_ResourceMgr* resMgr = resourceMgr();
   QPixmap pix;
-  if ( icon_id.length() )
-    pix = resMgr->loadPixmap( "SMESH", tr( icon_id ) );
+  if ( !icon_id.isEmpty() )
+    pix = resMgr->loadPixmap( "SMESH", tr( icon_id.toLatin1().data() ) );
   else
-    pix = resMgr->loadPixmap( "SMESH", tr( QString( "ICO_" )+po_id ), false );
+    pix = resMgr->loadPixmap( "SMESH", tr( QString( "ICO_%1" ).arg( po_id ).toLatin1().data() ), false );
   if ( !pix.isNull() )
-    icon = QIconSet( pix );
+    icon = QIcon( pix );
 
-  QString tooltip    = tr( QString( "TOP_" )+po_id ),
-          menu       = tr( QString( "MEN_" )+po_id ),
-          status_bar = tr( QString( "STB_" )+po_id );
+  QString tooltip    = tr( QString( "TOP_%1" ).arg( po_id ).toLatin1().data() ),
+          menu       = tr( QString( "MEN_%1" ).arg( po_id ).toLatin1().data() ),
+          status_bar = tr( QString( "STB_%1" ).arg( po_id ).toLatin1().data() );
 
   createAction( id, tooltip, icon, menu, status_bar, key, parent, toggle, this, SLOT( OnGUIEvent() )  );
 }
@@ -2364,9 +2362,10 @@ void SMESHGUI::createPopupItem( const int id,
   if( !popupMgr()->contains( popupMgr()->actionId( action( id ) ) ) )
     popupMgr()->insert( action( id ), parentId, 0 );
 
-  QChar lc = QtxPopupMgr::Selection::defEquality();
+  QString lc = "$";        // VSR : instead of QtxPopupSelection::defEquality();
+  QString dc = "selcount"; // VSR : insetad of QtxPopupSelection::defSelCountParam()
   QString rule = "(%1) and (%2) and (%3)";
-  rule = rule.arg( QString( "%1>0" ).arg( QtxPopupMgr::Selection::defSelCountParam() ) );
+  rule = rule.arg( QString( "%1>0" ).arg( dc ) );
   if( clients.isEmpty() )
     rule = rule.arg( QString( "true" ) );
   else
@@ -2378,7 +2377,7 @@ void SMESHGUI::createPopupItem( const int id,
   if( cont )
     rule = QString( "%1 or (%2)" ).arg( myRules[ id ] ).arg( rule );
 
-  popupMgr()->setRule( action( id ), rule, true );
+  popupMgr()->setRule( action( id ), rule, QtxPopupMgr::VisibleRule );
   myRules[ id ] = QString( cont ? "%1" : "(%1)" ).arg( rule );
 }
 
@@ -2397,9 +2396,9 @@ void SMESHGUI::initialize( CAM_Application* app )
 
   // ----- create actions --------------
 
-  createSMESHAction(  111, "DAT", "", (CTRL+Key_B) );
-  createSMESHAction(  112, "UNV", "", (CTRL+Key_U) );
-  createSMESHAction(  113, "MED", "", (CTRL+Key_M) );
+  createSMESHAction(  111, "DAT", "", (Qt::CTRL+Qt::Key_B) );
+  createSMESHAction(  112, "UNV", "", (Qt::CTRL+Qt::Key_U) );
+  createSMESHAction(  113, "MED", "", (Qt::CTRL+Qt::Key_M) );
   createSMESHAction(  114, "NUM" );
   createSMESHAction(  121, "DAT" );
   createSMESHAction(  122, "MED" );
@@ -2409,7 +2408,7 @@ void SMESHGUI::initialize( CAM_Application* app )
   createSMESHAction(  125, "EXPORT_MED" );
   createSMESHAction(  126, "EXPORT_UNV" );
   createSMESHAction(  141, "EXPORT_STL" );
-  createSMESHAction(   33, "DELETE",          "ICON_DELETE" );
+  createSMESHAction(   33, "DELETE",          "ICON_DELETE", Qt::Key_Delete );
   createSMESHAction( 5105, "SEL_FILTER_LIB" );
   createSMESHAction(  701, "COMPUTE",         "ICON_COMPUTE" );
   createSMESHAction(  702, "CREATE_MESH",     "ICON_DLG_INIT_MESH" );
@@ -2427,15 +2426,16 @@ void SMESHGUI::initialize( CAM_Application* app )
   createSMESHAction(  813, "DEL_GROUP",       "ICON_DEL_GROUP" );
   createSMESHAction(  900, "ADV_INFO",        "ICON_ADV_INFO" );
   createSMESHAction(  902, "STD_INFO",        "ICON_STD_INFO" );
-  createSMESHAction( 6001, "LENGTH",          "ICON_LENGTH" ,       0, true );
-  createSMESHAction( 6002, "FREE_EDGE",       "ICON_FREE_EDGE" ,    0, true );
-  createSMESHAction( 6003, "FREE_BORDER",     "ICON_FREE_EDGE_2D" , 0, true );
-  createSMESHAction( 6004, "CONNECTION",      "ICON_CONNECTION" ,   0, true );
-  createSMESHAction( 6011, "AREA",            "ICON_AREA" ,         0, true );
-  createSMESHAction( 6012, "TAPER",           "ICON_TAPER" ,        0, true );
-  createSMESHAction( 6013, "ASPECT",          "ICON_ASPECT" ,       0, true );
-  createSMESHAction( 6014, "MIN_ANG",         "ICON_ANGLE" ,        0, true );
-  createSMESHAction( 6015, "WARP",            "ICON_WARP" ,         0, true );
+  createSMESHAction(  903, "WHAT_IS",         "ICON_WHAT_IS" );
+  createSMESHAction( 6001, "LENGTH",          "ICON_LENGTH",        0, true );
+  createSMESHAction( 6002, "FREE_EDGE",       "ICON_FREE_EDGE",     0, true );
+  createSMESHAction( 6003, "FREE_BORDER",     "ICON_FREE_EDGE_2D",  0, true );
+  createSMESHAction( 6004, "CONNECTION",      "ICON_CONNECTION",    0, true );
+  createSMESHAction( 6011, "AREA",            "ICON_AREA",          0, true );
+  createSMESHAction( 6012, "TAPER",           "ICON_TAPER",         0, true );
+  createSMESHAction( 6013, "ASPECT",          "ICON_ASPECT",        0, true );
+  createSMESHAction( 6014, "MIN_ANG",         "ICON_ANGLE",         0, true );
+  createSMESHAction( 6015, "WARP",            "ICON_WARP",          0, true );
   createSMESHAction( 6016, "SKEW",            "ICON_SKEW",          0, true );
   createSMESHAction( 6017, "ASPECT_3D",       "ICON_ASPECT_3D",     0, true );
   createSMESHAction( 6018, "LENGTH_2D",       "ICON_LENGTH_2D",     0, true );
@@ -2483,7 +2483,7 @@ void SMESHGUI::initialize( CAM_Application* app )
   createSMESHAction(  219, "VOLUMES",        "ICON_DLG_TETRAS", 0, true );
   createSMESHAction(  220, "ALL" );
   createSMESHAction( 1100, "EDIT_HYPO" );
-  createSMESHAction( 1101, "RENAME" );
+  createSMESHAction( 1101, "RENAME", "", Qt::Key_F2 );
   createSMESHAction( 1102, "UNASSIGN" );
   createSMESHAction( 9010, "NUM_NODES", "", 0, true );
   createSMESHAction( 9011, "NUM_ELEMENTS", "", 0, true );
@@ -2492,6 +2492,8 @@ void SMESHGUI::initialize( CAM_Application* app )
   createSMESHAction( 1133, "TRANSP" );
   createSMESHAction( 1134, "CLIP" );
   createSMESHAction( 1135, "DISP_ENT" );
+  createSMESHAction( 1136, "AUTO_COLOR" );
+  createSMESHAction( 1137, "DISABLE_AUTO_COLOR" );
   createSMESHAction( 2000, "CTRL" );
 
   createSMESHAction( 300, "ERASE" );
@@ -2558,6 +2560,7 @@ void SMESHGUI::initialize( CAM_Application* app )
   createMenu( separator(), meshId, -1 );
   createMenu( 900, meshId, -1 );
   createMenu( 902, meshId, -1 );
+  createMenu( 903, meshId, -1 );
   createMenu( separator(), meshId, -1 );
 
   createMenu( 6003, ctrlId, -1 );
@@ -2644,6 +2647,7 @@ void SMESHGUI::initialize( CAM_Application* app )
   createTool( separator(), meshTb );
   createTool( 900, meshTb );
   createTool( 902, meshTb );
+  createTool( 903, meshTb );
   createTool( separator(), meshTb );
 
   createTool( 6001, ctrlTb );
@@ -2711,6 +2715,8 @@ void SMESHGUI::initialize( CAM_Application* app )
 
   createTool( 214, dispModeTb );
 
+  QString lc = "$";        // VSR : instead of QtxPopupSelection::defEquality();
+  QString dc = "selcount"; // VSR : insetad of QtxPopupSelection::defSelCountParam()
 
   myRules.clear();
   QString OB = "'ObjectBrowser'",
@@ -2741,6 +2747,7 @@ void SMESHGUI::initialize( CAM_Application* app )
   createPopupItem( 214, OB, mesh_group );                  // UPDATE
   createPopupItem( 900, OB, mesh_group );                  // ADV_INFO
   createPopupItem( 902, OB, mesh );                        // STD_INFO
+  createPopupItem( 903, OB, mesh_group );                  // WHAT_IS
   popupMgr()->insert( separator(), -1, 0 );
   createPopupItem( 801, OB, mesh );                        // CREATE_GROUP
   createPopupItem( 802, OB, subMesh );                     // CONSTRUCT_GROUP
@@ -2750,11 +2757,12 @@ void SMESHGUI::initialize( CAM_Application* app )
   createPopupItem( 1101, OB, mesh_group + " " + hyp_alg, "" /*"&& $hasReference={false}"*/ ); // RENAME
   popupMgr()->insert( separator(), -1, 0 );
 
-  QString only_one_non_empty = QString( " && %1=1 && numberOfNodes>0" ).arg( QtxPopupMgr::Selection::defSelCountParam() );
-  createPopupItem( 125, OB, mesh, only_one_non_empty );    // EXPORT_MED
-  createPopupItem( 126, OB, mesh, only_one_non_empty );    // EXPORT_UNV
-  createPopupItem( 141, OB, mesh, only_one_non_empty );    // EXPORT_STL
-  createPopupItem( 33, OB, subMesh + " " + group );        // DELETE
+  QString only_one_non_empty = QString( " && %1=1 && numberOfNodes>0" ).arg( dc );
+  createPopupItem( 125, OB, mesh, only_one_non_empty );   // EXPORT_MED
+  createPopupItem( 126, OB, mesh, only_one_non_empty );   // EXPORT_UNV
+  createPopupItem( 141, OB, mesh, only_one_non_empty );   // EXPORT_STL
+  //createPopupItem( 33, OB, subMesh + " " + group );       // DELETE
+  createPopupItem(  33, OB, mesh_group + " " + hyp_alg ); // DELETE
   popupMgr()->insert( separator(), -1, 0 );
 
   // popup for viewer
@@ -2765,6 +2773,11 @@ void SMESHGUI::initialize( CAM_Application* app )
   createPopupItem( 214, View, mesh_group ); // UPDATE
   createPopupItem( 900, View, mesh_group ); // ADV_INFO
   createPopupItem( 902, View, mesh );       // STD_INFO
+  createPopupItem( 903, View, mesh_group ); // WHAT_IS
+  popupMgr()->insert( separator(), -1, 0 );
+
+  createPopupItem( 1136, OB + " " + View, mesh, "&& (not isAutoColor)" ); // AUTO_COLOR
+  createPopupItem( 1137, OB + " " + View, mesh, "&& isAutoColor" );       // DISABLE_AUTO_COLOR
   popupMgr()->insert( separator(), -1, 0 );
 
   int anId;
@@ -2781,24 +2794,27 @@ void SMESHGUI::initialize( CAM_Application* app )
     hasFaces("({'Face'} in elemTypes)"),
     hasVolumes("({'Volume'} in elemTypes)");
 
-  QString lc = QtxPopupMgr::Selection::defEquality();
   QString aClient = QString( "%1client in {%2}" ).arg( lc ).arg( "'VTKViewer'" );
-  QString aType = QString( "%1type in {%2}" ).arg( QtxPopupMgr::Selection::defEquality() );
+  QString aType = QString( "%1type in {%2}" ).arg( lc );
   aType = aType.arg( mesh_group );
   QString aMeshInVTK = aClient + "&&" + aType;
 
+  aClient = "($client in {'VTKViewer' 'ObjectBrowser'})";
+  QString anActiveVTK = QString("activeView = '%1'").arg(SVTK_Viewer::Type());
+  QString aSelCount = QString( "%1 > 0" ).arg( dc );
+
   //-------------------------------------------------
   // Numbering
   //-------------------------------------------------
   anId = popupMgr()->insert( tr( "MEN_NUM" ), -1, -1 );
 
   popupMgr()->insert( action( 9010 ), anId, -1 );
-  popupMgr()->setRule( action( 9010 ), aMeshInVTK + "&& isVisible &&" + hasNodes, true );
-  popupMgr()->setRule( action( 9010 ), "{'Point'} in labeledTypes", false );
+  popupMgr()->setRule( action( 9010 ), aMeshInVTK + "&& isVisible &&" + hasNodes, QtxPopupMgr::VisibleRule );
+  popupMgr()->setRule( action( 9010 ), "{'Point'} in labeledTypes", QtxPopupMgr::ToggleRule );
 
   popupMgr()->insert( action( 9011 ), anId, -1 );
-  popupMgr()->setRule( action( 9011 ), aMeshInVTK + "&& isVisible &&" + hasElems, true );
-  popupMgr()->setRule( action( 9011 ), "{'Cell'} in labeledTypes", false );
+  popupMgr()->setRule( action( 9011 ), aMeshInVTK + "&& isVisible &&" + hasElems, QtxPopupMgr::VisibleRule );
+  popupMgr()->setRule( action( 9011 ), "{'Cell'} in labeledTypes", QtxPopupMgr::ToggleRule );
 
   popupMgr()->insert( separator(), -1, -1 );
 
@@ -2808,22 +2824,22 @@ void SMESHGUI::initialize( CAM_Application* app )
   anId = popupMgr()->insert( tr( "MEN_DISPMODE" ), -1, -1 );
 
   popupMgr()->insert( action( 211 ), anId, -1 ); // WIRE
-  popupMgr()->setRule( action( 211 ), aMeshInVTK + "&&" + hasElems, true );
-  popupMgr()->setRule( action( 211 ), "displayMode = 'eEdge'", false );
+  popupMgr()->setRule( action( 211 ), aMeshInVTK + "&&" + hasElems, QtxPopupMgr::VisibleRule );
+  popupMgr()->setRule( action( 211 ), "displayMode = 'eEdge'", QtxPopupMgr::ToggleRule );
 
   popupMgr()->insert( action( 212 ), anId, -1 ); // SHADE
-  popupMgr()->setRule( action( 212 ),aMeshInVTK+ "&& (" + hasFaces + "||" + hasVolumes + ")",true);
-  popupMgr()->setRule( action( 212 ), "displayMode = 'eSurface'", false );
+  popupMgr()->setRule( action( 212 ),aMeshInVTK+ "&& (" + hasFaces + "||" + hasVolumes + ")", QtxPopupMgr::VisibleRule);
+  popupMgr()->setRule( action( 212 ), "displayMode = 'eSurface'", QtxPopupMgr::ToggleRule );
 
   popupMgr()->insert( action( 215 ), anId, -1 ); // POINTS
-  popupMgr()->setRule( action( 215 ), aMeshInVTK + "&&" + hasNodes, true );
-  popupMgr()->setRule( action( 215 ), "displayMode = 'ePoint'", false );
+  popupMgr()->setRule( action( 215 ), aMeshInVTK + "&&" + hasNodes, QtxPopupMgr::VisibleRule );
+  popupMgr()->setRule( action( 215 ), "displayMode = 'ePoint'", QtxPopupMgr::ToggleRule );
 
   popupMgr()->insert( separator(), anId, -1 );
 
   popupMgr()->insert( action( 213 ), anId, -1 ); // SHRINK
-  popupMgr()->setRule( action( 213 ), aMeshInVTK + "&& shrinkMode <> 'IsNotShrinkable' && displayMode <> 'ePoint'",true);
-  popupMgr()->setRule( action( 213 ), "shrinkMode = 'IsShrunk'", false );
+  popupMgr()->setRule( action( 213 ), aMeshInVTK + "&& shrinkMode <> 'IsNotShrinkable' && displayMode <> 'ePoint'", QtxPopupMgr::VisibleRule);
+  popupMgr()->setRule( action( 213 ), "shrinkMode = 'IsShrunk'", QtxPopupMgr::ToggleRule );
 
   //-------------------------------------------------
   // Display Entity
@@ -2833,39 +2849,39 @@ void SMESHGUI::initialize( CAM_Application* app )
   anId = popupMgr()->insert( tr( "MEN_DISP_ENT" ), -1, -1 );
 
   popupMgr()->insert( action( 217 ), anId, -1 ); // EDGES
-  popupMgr()->setRule( action( 217 ), aDiffElemsInVTK + "&& isVisible &&" + hasEdges, true );
-  popupMgr()->setRule( action( 217 ), "{'Edge'} in entityMode", false );
+  popupMgr()->setRule( action( 217 ), aDiffElemsInVTK + "&& isVisible &&" + hasEdges, QtxPopupMgr::VisibleRule );
+  popupMgr()->setRule( action( 217 ), "{'Edge'} in entityMode", QtxPopupMgr::ToggleRule );
 
   popupMgr()->insert( action( 218 ), anId, -1 ); // FACES
-  popupMgr()->setRule( action( 218 ), aDiffElemsInVTK + "&& isVisible &&" + hasFaces, true );
-  popupMgr()->setRule( action( 218 ), "{'Face'} in entityMode", false );
+  popupMgr()->setRule( action( 218 ), aDiffElemsInVTK + "&& isVisible &&" + hasFaces, QtxPopupMgr::VisibleRule );
+  popupMgr()->setRule( action( 218 ), "{'Face'} in entityMode", QtxPopupMgr::ToggleRule );
 
   popupMgr()->insert( action( 219 ), anId, -1 ); // VOLUMES
-  popupMgr()->setRule( action( 219 ), aDiffElemsInVTK + "&& isVisible &&" + hasVolumes, true );
-  popupMgr()->setRule( action( 219 ), "{'Volume'} in entityMode", false );
+  popupMgr()->setRule( action( 219 ), aDiffElemsInVTK + "&& isVisible &&" + hasVolumes, QtxPopupMgr::VisibleRule );
+  popupMgr()->setRule( action( 219 ), "{'Volume'} in entityMode", QtxPopupMgr::ToggleRule );
 
   popupMgr()->insert( separator(), anId, -1 );
 
   popupMgr()->insert( action( 220 ), anId, -1 ); // ALL
-  popupMgr()->setRule( action( 220 ), aDiffElemsInVTK + "&& isVisible && not( elemTypes in entityMode )", true );
+  popupMgr()->setRule( action( 220 ), aDiffElemsInVTK + "&& isVisible && not( elemTypes in entityMode )", QtxPopupMgr::VisibleRule );
 
   //-------------------------------------------------
   // Color / Size
   //-------------------------------------------------
   popupMgr()->insert( action( 1132 ), -1, -1 );
-  popupMgr()->setRule( action( 1132 ), aMeshInVTK + "&& isVisible", true );
+  popupMgr()->setRule( action( 1132 ), aMeshInVTK + "&& isVisible", QtxPopupMgr::VisibleRule );
 
   //-------------------------------------------------
   // Transparency
   //-------------------------------------------------
   popupMgr()->insert( action( 1133 ), -1, -1 );
-  popupMgr()->setRule( action( 1133 ), aMeshInVTK + "&& isVisible", true );
+  popupMgr()->setRule( action( 1133 ), aMeshInVTK + "&& isVisible", QtxPopupMgr::VisibleRule );
 
   //-------------------------------------------------
   // Clipping
   //-------------------------------------------------
   popupMgr()->insert( action( 1134 ), -1, -1 );
-  popupMgr()->setRule( action( 1134 ), aMeshInVTK + "&& isVisible", true );
+  popupMgr()->setRule( action( 1134 ), aMeshInVTK + "&& isVisible", QtxPopupMgr::VisibleRule );
 
   popupMgr()->insert( separator(), -1, -1 );
 
@@ -2880,94 +2896,90 @@ void SMESHGUI::initialize( CAM_Application* app )
   anId = popupMgr()->insert( tr( "MEN_CTRL" ), -1, -1 );
 
   popupMgr()->insert( action( 200 ), anId, -1 ); // RESET
-  popupMgr()->setRule( action( 200 ), aMeshInVTK + "&& controlMode <> 'eNone'", true );
+  popupMgr()->setRule( action( 200 ), aMeshInVTK + "&& controlMode <> 'eNone'", QtxPopupMgr::VisibleRule );
 
   popupMgr()->insert( separator(), anId, -1 );
 
   popupMgr()->insert( action( 6003 ), anId, -1 ); // FREE_BORDER
-  popupMgr()->setRule( action( 6003 ), aMeshInVtkHasEdges, true );
-  popupMgr()->setRule( action( 6003 ), "controlMode = 'eFreeBorders'", false );
+  popupMgr()->setRule( action( 6003 ), aMeshInVtkHasEdges, QtxPopupMgr::VisibleRule );
+  popupMgr()->setRule( action( 6003 ), "controlMode = 'eFreeBorders'", QtxPopupMgr::ToggleRule );
 
   popupMgr()->insert( action( 6001 ), anId, -1 ); // LENGTH
-  popupMgr()->setRule( action( 6001 ), aMeshInVtkHasEdges, true );
-  popupMgr()->setRule( action( 6001 ), "controlMode = 'eLength'", false );
+  popupMgr()->setRule( action( 6001 ), aMeshInVtkHasEdges, QtxPopupMgr::VisibleRule );
+  popupMgr()->setRule( action( 6001 ), "controlMode = 'eLength'", QtxPopupMgr::ToggleRule );
 
   popupMgr()->insert( action( 6004 ), anId, -1 ); // CONNECTION
-  popupMgr()->setRule( action( 6004 ), aMeshInVtkHasEdges, true );
-  popupMgr()->setRule( action( 6004 ), "controlMode = 'eMultiConnection'", false );
+  popupMgr()->setRule( action( 6004 ), aMeshInVtkHasEdges, QtxPopupMgr::VisibleRule );
+  popupMgr()->setRule( action( 6004 ), "controlMode = 'eMultiConnection'", QtxPopupMgr::ToggleRule );
 
   popupMgr()->insert( separator(), anId, -1 );
 
   popupMgr()->insert( action( 6002 ), anId, -1 ); // FREE_EDGE
-  popupMgr()->setRule( action( 6002 ), aMeshInVtkHasFaces, true );
-  popupMgr()->setRule( action( 6002 ), "controlMode = 'eFreeEdges'", false );
+  popupMgr()->setRule( action( 6002 ), aMeshInVtkHasFaces, QtxPopupMgr::VisibleRule );
+  popupMgr()->setRule( action( 6002 ), "controlMode = 'eFreeEdges'", QtxPopupMgr::ToggleRule );
 
   popupMgr()->insert( action( 6018 ), anId, -1 ); // LENGTH_2D
-  popupMgr()->setRule( action( 6018 ), aMeshInVtkHasFaces, true );
-  popupMgr()->setRule( action( 6018 ), "controlMode = 'eLength2D'", false );
+  popupMgr()->setRule( action( 6018 ), aMeshInVtkHasFaces, QtxPopupMgr::VisibleRule );
+  popupMgr()->setRule( action( 6018 ), "controlMode = 'eLength2D'", QtxPopupMgr::ToggleRule );
 
   popupMgr()->insert( action( 6019 ), anId, -1 ); // CONNECTION_2D
-  popupMgr()->setRule( action( 6019 ), aMeshInVtkHasFaces, true );
-  popupMgr()->setRule( action( 6019 ), "controlMode = 'eMultiConnection2D'", false );
+  popupMgr()->setRule( action( 6019 ), aMeshInVtkHasFaces, QtxPopupMgr::VisibleRule );
+  popupMgr()->setRule( action( 6019 ), "controlMode = 'eMultiConnection2D'", QtxPopupMgr::ToggleRule );
 
   popupMgr()->insert( action( 6011 ), anId, -1 ); // AREA
-  popupMgr()->setRule( action( 6011 ), aMeshInVtkHasFaces, true );
-  popupMgr()->setRule( action( 6011 ), "controlMode = 'eArea'", false );
+  popupMgr()->setRule( action( 6011 ), aMeshInVtkHasFaces, QtxPopupMgr::VisibleRule );
+  popupMgr()->setRule( action( 6011 ), "controlMode = 'eArea'", QtxPopupMgr::ToggleRule );
 
   popupMgr()->insert( action( 6012 ), anId, -1 ); // TAPER
-  popupMgr()->setRule( action( 6012 ), aMeshInVtkHasFaces, true );
-  popupMgr()->setRule( action( 6012 ), "controlMode = 'eTaper'", false );
+  popupMgr()->setRule( action( 6012 ), aMeshInVtkHasFaces, QtxPopupMgr::VisibleRule );
+  popupMgr()->setRule( action( 6012 ), "controlMode = 'eTaper'", QtxPopupMgr::ToggleRule );
 
   popupMgr()->insert( action( 6013 ), anId, -1 ); // ASPECT
-  popupMgr()->setRule( action( 6013 ), aMeshInVtkHasFaces, true );
-  popupMgr()->setRule( action( 6013 ), "controlMode = 'eAspectRatio'", false );
+  popupMgr()->setRule( action( 6013 ), aMeshInVtkHasFaces, QtxPopupMgr::VisibleRule );
+  popupMgr()->setRule( action( 6013 ), "controlMode = 'eAspectRatio'", QtxPopupMgr::ToggleRule );
 
   popupMgr()->insert( action( 6014 ), anId, -1 ); // MIN_ANG
-  popupMgr()->setRule( action( 6014 ), aMeshInVtkHasFaces, true );
-  popupMgr()->setRule( action( 6014 ), "controlMode = 'eMinimumAngle'", false );
+  popupMgr()->setRule( action( 6014 ), aMeshInVtkHasFaces, QtxPopupMgr::VisibleRule );
+  popupMgr()->setRule( action( 6014 ), "controlMode = 'eMinimumAngle'", QtxPopupMgr::ToggleRule );
 
   popupMgr()->insert( action( 6015 ), anId, -1 ); // WARP
-  popupMgr()->setRule( action( 6015 ), aMeshInVtkHasFaces, true );
-  popupMgr()->setRule( action( 6015 ), "controlMode = 'eWarping'", false );
+  popupMgr()->setRule( action( 6015 ), aMeshInVtkHasFaces, QtxPopupMgr::VisibleRule );
+  popupMgr()->setRule( action( 6015 ), "controlMode = 'eWarping'", QtxPopupMgr::ToggleRule );
 
   popupMgr()->insert( action( 6016 ), anId, -1 ); // SKEW
-  popupMgr()->setRule( action( 6016 ), aMeshInVtkHasFaces, true );
-  popupMgr()->setRule( action( 6016 ), "controlMode = 'eSkew'", false );
+  popupMgr()->setRule( action( 6016 ), aMeshInVtkHasFaces, QtxPopupMgr::VisibleRule );
+  popupMgr()->setRule( action( 6016 ), "controlMode = 'eSkew'", QtxPopupMgr::ToggleRule );
 
   popupMgr()->insert( separator(), anId, -1 );
 
   popupMgr()->insert( action( 6017 ), anId, -1 ); // ASPECT_3D
-  popupMgr()->setRule( action( 6017 ), aMeshInVtkHasVolumes, true );
-  popupMgr()->setRule( action( 6017 ), "controlMode = 'eAspectRatio3D'", false );
+  popupMgr()->setRule( action( 6017 ), aMeshInVtkHasVolumes, QtxPopupMgr::VisibleRule );
+  popupMgr()->setRule( action( 6017 ), "controlMode = 'eAspectRatio3D'", QtxPopupMgr::ToggleRule );
 
   popupMgr()->insert ( action( 6009 ), anId, -1 ); // VOLUME_3D
-  popupMgr()->setRule( action( 6009 ), aMeshInVtkHasVolumes, true );
-  popupMgr()->setRule( action( 6009 ), "controlMode = 'eVolume3D'", false );
+  popupMgr()->setRule( action( 6009 ), aMeshInVtkHasVolumes, QtxPopupMgr::VisibleRule );
+  popupMgr()->setRule( action( 6009 ), "controlMode = 'eVolume3D'", QtxPopupMgr::ToggleRule );
 
   popupMgr()->insert( separator(), anId, -1 );
 
   popupMgr()->insert( action( 201 ), anId, -1 ); // SCALAR_BAR_PROP
-  popupMgr()->setRule( action( 201 ), aMeshInVTK + "&& controlMode <> 'eNone'", true );
+  popupMgr()->setRule( action( 201 ), aMeshInVTK + "&& controlMode <> 'eNone'", QtxPopupMgr::VisibleRule );
 
   popupMgr()->insert( separator(), -1, -1 );
 
   //-------------------------------------------------
   // Display / Erase
   //-------------------------------------------------
-  aClient = "($client in {'VTKViewer' 'ObjectBrowser'})";
-  QString anActiveVTK = QString("activeView = '%1'").arg(SVTK_Viewer::Type());
-  QString aSelCount = QString( "%1 > 0" ).arg( QtxPopupMgr::Selection::defSelCountParam() );
-
   QString aRule = "$component={'SMESH'} and ( type='Component' or (" + aClient + " and " +
     aType + " and " + aSelCount + " and " + anActiveVTK + " and " + isNotEmpty + " %1 ) )";
   popupMgr()->insert( action( 301 ), -1, -1 ); // DISPLAY
-  popupMgr()->setRule( action( 301 ), aRule.arg( "and (not isVisible)" ), true);
+  popupMgr()->setRule( action( 301 ), aRule.arg( "and (not isVisible)" ), QtxPopupMgr::VisibleRule );
 
   popupMgr()->insert( action( 300 ), -1, -1 ); // ERASE
-  popupMgr()->setRule( action( 300 ), aRule.arg( "and isVisible" ), true );
+  popupMgr()->setRule( action( 300 ), aRule.arg( "and isVisible" ), QtxPopupMgr::VisibleRule );
 
   popupMgr()->insert( action( 302 ), -1, -1 ); // DISPLAY_ONLY
-  popupMgr()->setRule( action( 302 ), aRule.arg( "" ), true );
+  popupMgr()->setRule( action( 302 ), aRule.arg( "" ), QtxPopupMgr::VisibleRule );
 
   popupMgr()->insert( separator(), -1, -1 );
 
@@ -2983,9 +2995,9 @@ bool SMESHGUI::activateModule( SUIT_Study* study )
   setToolShown( true );
 
   // Reset actions accelerator keys
-  action(111)->setAccel(QKeySequence(CTRL + Key_B)); // Import DAT
-  action(112)->setAccel(QKeySequence(CTRL + Key_U)); // Import UNV
-  action(113)->setAccel(QKeySequence(CTRL + Key_M)); // Import MED
+  action(111)->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_B)); // Import DAT
+  action(112)->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_U)); // Import UNV
+  action(113)->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_M)); // Import MED
 
   return res;
 }
@@ -2998,13 +3010,19 @@ bool SMESHGUI::deactivateModule( SUIT_Study* study )
   EmitSignalCloseAllDialogs();
 
   // Unset actions accelerator keys
-  action(111)->setAccel(QKeySequence()); // Import DAT
-  action(112)->setAccel(QKeySequence()); // Import UNV
-  action(113)->setAccel(QKeySequence()); // Import MED
+  action(111)->setShortcut(QKeySequence()); // Import DAT
+  action(112)->setShortcut(QKeySequence()); // Import UNV
+  action(113)->setShortcut(QKeySequence()); // Import MED
 
   return SalomeApp_Module::deactivateModule( study );
 }
 
+void SMESHGUI::studyClosed( SUIT_Study* s )
+{
+  SMESH::RemoveVisuData( s->id() );
+  SalomeApp_Module::studyClosed( s );
+}
+
 void SMESHGUI::OnGUIEvent()
 {
   const QObject* obj = sender();
@@ -3037,17 +3055,15 @@ QString SMESHGUI::engineIOR() const
   return QString( anIOR.in() );
 }
 
-void SMESHGUI::contextMenuPopup( const QString& client, QPopupMenu* menu, QString& /*title*/ )
+LightApp_Selection* SMESHGUI::createSelection( const QString& client, LightApp_SelectionMgr* mgr ) const
 {
-  SMESHGUI_Selection sel;
-  sel.init( client, selectionMgr() );
-  popupMgr()->updatePopup( menu, &sel );
+  return new SMESHGUI_Selection( client, mgr );
 }
 
 void SMESHGUI::windows( QMap<int, int>& aMap ) const
 {
-  aMap.insert( SalomeApp_Application::WT_ObjectBrowser, Qt::DockLeft );
-  aMap.insert( SalomeApp_Application::WT_PyConsole, Qt::DockBottom );
+  aMap.insert( SalomeApp_Application::WT_ObjectBrowser, Qt::LeftDockWidgetArea );
+  aMap.insert( SalomeApp_Application::WT_PyConsole, Qt::BottomDockWidgetArea );
 }
 
 void SMESHGUI::viewManagers( QStringList& list ) const
@@ -3087,7 +3103,7 @@ void SMESHGUI::createPreferences()
   modes.append( "Shading" );
   modes.append( "Nodes" );
   modes.append( "Shrink" );
-  QValueList<QVariant> indices;
+  QList<QVariant> indices;
   indices.append( 0 );
   indices.append( 1 );
   indices.append( 2 );
@@ -3097,7 +3113,7 @@ void SMESHGUI::createPreferences()
 
   int exportgroup = addPreference( tr( "PREF_GROUP_EXPORT" ), genTab );
   addPreference( tr( "PREF_AUTO_GROUPS" ), exportgroup, LightApp_Preferences::Bool, "SMESH", "auto_groups" );
-  int renumber=addPreference( tr( "PREF_RENUMBER" ), exportgroup, LightApp_Preferences::Bool, "SMESH", "renumbering" );
+  addPreference( tr( "PREF_RENUMBER" ), exportgroup, LightApp_Preferences::Bool, "SMESH", "renumbering" );
 
   int meshTab = addPreference( tr( "PREF_TAB_MESH" ) );
   int nodeGroup = addPreference( tr( "PREF_GROUP_NODES" ), meshTab );
@@ -3147,6 +3163,7 @@ void SMESHGUI::createPreferences()
 
   addPreference( tr( "PREF_NODES" ), precSelGroup, LightApp_Preferences::Double, "SMESH", "selection_precision_node" );
   addPreference( tr( "PREF_ELEMENTS" ), precSelGroup, LightApp_Preferences::Double, "SMESH", "selection_precision_element" );
+  addPreference( tr( "PREF_OBJECTS" ), precSelGroup, LightApp_Preferences::Double, "SMESH", "selection_precision_object" );
 
   int sbarTab = addPreference( tr( "SMESH_SCALARBAR" ) );
   int fontGr = addPreference( tr( "SMESH_FONT_SCALARBAR" ), sbarTab );
@@ -3160,7 +3177,7 @@ void SMESHGUI::createPreferences()
   fam.append( tr( "SMESH_FONT_ARIAL" ) );
   fam.append( tr( "SMESH_FONT_COURIER" ) );
   fam.append( tr( "SMESH_FONT_TIMES" ) );
-  int wflag = ( QtxListResourceEdit::FontItem::All & ( ~( QtxListResourceEdit::FontItem::Size | QtxListResourceEdit::FontItem::UserSize ) ) );
+  int wflag = ( QtxFontEdit::Family | QtxFontEdit::Scripting );
 
   setPreferenceProperty( tfont, "families", fam );
   setPreferenceProperty( tfont, "system", false );
@@ -3237,7 +3254,8 @@ void SMESHGUI::preferencesChanged( const QString& sect, const QString& name )
     SUIT_ResourceMgr* aResourceMgr = SMESH::GetResourceMgr(this);
     if( name=="selection_object_color" || name=="selection_element_color" ||
         name=="selection_width" || name=="highlight_color" || name=="highlight_width" ||
-        name=="selection_precision_node" || name=="selection_precision_element" )
+        name=="selection_precision_node" || name=="selection_precision_element" ||
+       name=="selection_precision_object")
       SMESH::UpdateSelectionProp( this );
     else if (name == QString("scalar_bar_vertical_x") || name == QString("scalar_bar_vertical_width")){
       sbX1 = aResourceMgr->doubleValue("SMESH", "scalar_bar_vertical_x", sbX1);
@@ -3284,10 +3302,9 @@ void SMESHGUI::preferencesChanged( const QString& sect, const QString& name )
 
     if(aWarning.size() != 0){
       aWarning += "The default values are applied instead.";
-      SUIT_MessageBox::warn1(SMESHGUI::desktop(),
-                            QObject::tr("SMESH_ERR_SCALARBAR_PARAMS"),
-                            QObject::tr(aWarning.c_str()),
-                            QObject::tr("SMESH_BUT_OK"));
+      SUIT_MessageBox::warning(SMESHGUI::desktop(),
+                              QObject::tr("SMESH_ERR_SCALARBAR_PARAMS"),
+                              QObject::tr(aWarning.c_str()));
     }
   }
 }
@@ -3403,3 +3420,60 @@ LightApp_Displayer* SMESHGUI::displayer()
   return myDisplayer;
 }
 
+SALOMEDS::Color SMESHGUI::getUniqueColor( const QList<SALOMEDS::Color>& theReservedColors )
+{
+  int aHue = -1;
+  int aTolerance = 64;
+  int anIterations = 0;
+  int aPeriod = 5;
+
+  while( 1 )
+  {
+    anIterations++;
+    if( anIterations % aPeriod == 0 )
+    {
+      aTolerance /= 2;
+      if( aTolerance < 1 )
+       break;
+    }
+    //cout << "Iteration N" << anIterations << " (tolerance=" << aTolerance << ")"<< endl;
+
+    aHue = (int)( 360.0 * rand() / RAND_MAX );
+    //cout << "Hue = " << aHue << endl;
+
+    //cout << "Auto colors : ";
+    bool ok = true;
+    QList<SALOMEDS::Color>::const_iterator it = theReservedColors.constBegin();
+    QList<SALOMEDS::Color>::const_iterator itEnd = theReservedColors.constEnd();
+    for( ; it != itEnd; ++it )
+    {
+      SALOMEDS::Color anAutoColor = *it;
+      QColor aQColor( (int)( anAutoColor.R * 255.0 ), (int)( anAutoColor.G * 255.0 ), (int)( anAutoColor.B * 255.0 ) );
+
+      int h, s, v;
+      aQColor.getHsv( &h, &s, &v );
+      //cout << h << " ";
+      if( abs( h - aHue ) < aTolerance )
+      {
+       ok = false;
+       //cout << "break (diff = " << abs( h - aHue ) << ")";
+       break;
+      }
+    }
+    //cout << endl;
+
+    if( ok )
+      break;
+  }
+
+  //cout << "Hue of the returned color = " << aHue << endl;
+  QColor aColor;
+  aColor.setHsv( aHue, 255, 255 );
+
+  SALOMEDS::Color aSColor;
+  aSColor.R = (double)aColor.red() / 255.0;
+  aSColor.G = (double)aColor.green() / 255.0;
+  aSColor.B = (double)aColor.blue() / 255.0;
+
+  return aSColor;
+}