Salome HOME
Merging with WPdev
[modules/smesh.git] / src / SMESHGUI / SMESHGUI.cxx
index b8d0b6bd8ad00bfc1a44014d2e1f5428e3e51782..e570b199dac05fba338acdf48bc0d7a0e45e49e6 100644 (file)
@@ -17,7 +17,7 @@
 //  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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
 //  File   : SMESHGUI.cxx
 //  Author : Nicolas REJNERI
@@ -42,8 +42,6 @@
 #include "SMESHGUI_MoveNodesDlg.h"
 #include "SMESHGUI_AddMeshElementDlg.h"
 #include "SMESHGUI_AddQuadraticElementDlg.h"
-#include "SMESHGUI_EditHypothesesDlg.h"
-#include "SMESHGUI_CreateHypothesesDlg.h"
 #include "SMESHGUI_FilterDlg.h"
 #include "SMESHGUI_FilterLibraryDlg.h"
 #include "SMESHGUI_SingleEditDlg.h"
@@ -62,9 +60,9 @@
 #include "SMESHGUI_MergeNodesDlg.h"
 #include "SMESHGUI_EditMeshDlg.h"
 #include "SMESHGUI_MeshPatternDlg.h"
-#include "SMESHGUI_PrecisionDlg.h"
 #include "SMESHGUI_Selection.h"
 #include "SMESHGUI_CreatePolyhedralVolumeDlg.h"
+#include "SMESHGUI_ConvToQuadOp.h"
 #include "SMESHGUI_MeshOp.h"
 #include "SMESHGUI_Displayer.h"
 
 
 using namespace std;
 
-namespace{
+//namespace{
   // Declarations
   //=============================================================
   void ImportMeshesFromFile(SMESH::SMESH_Gen_ptr theComponentMesh,
@@ -332,7 +330,7 @@ namespace{
             aFormat = aFilterMap[fd->selectedFilter()];
             is_ok = true;
             if ( !aFilename.isEmpty()
-                 && (aMesh->NbPolygons()>0 or aMesh->NbPolyhedrons()>0)
+                 && (aMesh->NbPolygons()>0 || aMesh->NbPolyhedrons()>0)
                  && aFormat==SMESH::MED_V2_1) {
               int aRet = SUIT_MessageBox::warn2(SMESHGUI::desktop(),
                                                 QObject::tr("SMESH_WRN_WARNING"),
@@ -354,21 +352,32 @@ namespace{
          if ( aFile.exists() )
            aFile.remove();
          SUIT_OverrideCursor wc;
-         switch ( theCommandID ) {
-         case 125:
-         case 122:
-           aMesh->ExportToMED( aFilename.latin1(), toCreateGroups, aFormat );
-           break;
-         case 124:
-         case 121:
-           aMesh->ExportDAT( aFilename.latin1() );
-           break;
-         case 126:
-         case 123:
-           aMesh->ExportUNV( aFilename.latin1() );
-           break;
-         default:
-           break;
+
+         try {
+           switch ( theCommandID ) {
+           case 125:
+           case 122:
+             aMesh->ExportToMED( aFilename.latin1(), toCreateGroups, aFormat );
+             break;
+           case 124:
+           case 121:
+             aMesh->ExportDAT( aFilename.latin1() );
+             break;
+           case 126:
+           case 123:
+             aMesh->ExportUNV( aFilename.latin1() );
+             break;
+           default:
+             break;
+           }
+         }
+         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"));
+           wc.resume();
          }
        }
       }
@@ -460,28 +469,28 @@ namespace{
              anActor->SetRepresentation(SMESH_Actor::ePoint);
              break;
            case 1132:{
-             float color[3];
+             vtkFloatingPointType color[3];
              anActor->GetSufaceColor(color[0], color[1], color[2]);
              int c0 = int (color[0] * 255);
              int c1 = int (color[1] * 255);
              int c2 = int (color[2] * 255);
              QColor c(c0, c1, c2);
 
-             float edgecolor[3];
+             vtkFloatingPointType edgecolor[3];
              anActor->GetEdgeColor(edgecolor[0], edgecolor[1], edgecolor[2]);
              c0 = int (edgecolor[0] * 255);
              c1 = int (edgecolor[1] * 255);
              c2 = int (edgecolor[2] * 255);
              QColor e(c0, c1, c2);
 
-             float backfacecolor[3];
+             vtkFloatingPointType backfacecolor[3];
              anActor->GetBackSufaceColor(backfacecolor[0], backfacecolor[1], backfacecolor[2]);
              c0 = int (backfacecolor[0] * 255);
              c1 = int (backfacecolor[1] * 255);
              c2 = int (backfacecolor[2] * 255);
              QColor b(c0, c1, c2);
 
-             float nodecolor[3];
+             vtkFloatingPointType nodecolor[3];
              anActor->GetNodeColor(nodecolor[0], nodecolor[1], nodecolor[2]);
              c0 = int (nodecolor[0] * 255);
              c1 = int (nodecolor[1] * 255);
@@ -492,7 +501,7 @@ namespace{
              if(Edgewidth == 0)
                Edgewidth = 1;
              int intValue = int(anActor->GetNodeSize());
-             float Shrink = anActor->GetShrinkFactor();
+             vtkFloatingPointType Shrink = anActor->GetShrinkFactor();
 
              SMESHGUI_Preferences_ColorDlg *aDlg =
                new SMESHGUI_Preferences_ColorDlg( SMESHGUI::GetSMESHGUI(), "" );
@@ -509,26 +518,26 @@ namespace{
                QColor nodecolor = aDlg->GetColor(3);
                QColor backfacecolor = aDlg->GetColor(4);
                /* actor color and backface color */
-               anActor->SetSufaceColor(float (color.red()) / 255.,
-                                        float (color.green()) / 255.,
-                                        float (color.blue()) / 255.);
-               anActor->SetBackSufaceColor(float (backfacecolor.red()) / 255.,
-                                            float (backfacecolor.green()) / 255.,
-                                            float (backfacecolor.blue()) / 255.);
+               anActor->SetSufaceColor(vtkFloatingPointType (color.red()) / 255.,
+                                       vtkFloatingPointType (color.green()) / 255.,
+                                       vtkFloatingPointType (color.blue()) / 255.);
+               anActor->SetBackSufaceColor(vtkFloatingPointType (backfacecolor.red()) / 255.,
+                                           vtkFloatingPointType (backfacecolor.green()) / 255.,
+                                           vtkFloatingPointType (backfacecolor.blue()) / 255.);
 
                /* edge color */
-               anActor->SetEdgeColor(float (edgecolor.red()) / 255.,
-                                      float (edgecolor.green()) / 255.,
-                                      float (edgecolor.blue()) / 255.);
+               anActor->SetEdgeColor(vtkFloatingPointType (edgecolor.red()) / 255.,
+                                     vtkFloatingPointType (edgecolor.green()) / 255.,
+                                     vtkFloatingPointType (edgecolor.blue()) / 255.);
 
                /* Shrink factor and size edges */
                anActor->SetShrinkFactor(aDlg->GetIntValue(3) / 100.);
                anActor->SetLineWidth(aDlg->GetIntValue(1));
 
                /* Nodes color and size */
-               anActor->SetNodeColor(float (nodecolor.red()) / 255.,
-                              float (nodecolor.green()) / 255.,
-                                      float (nodecolor.blue()) / 255.);
+               anActor->SetNodeColor(vtkFloatingPointType (nodecolor.red()) / 255.,
+                                     vtkFloatingPointType (nodecolor.green()) / 255.,
+                                     vtkFloatingPointType (nodecolor.blue()) / 255.);
                anActor->SetNodeSize(aDlg->GetIntValue(2));
 
                delete aDlg;
@@ -732,72 +741,81 @@ namespace{
     SALOME_ListIteratorOfListIO It(selected);
 
     aStudyBuilder->NewCommand();  // There is a transaction
-    for(; It.More(); It.Next()){
+    for(; It.More(); It.Next()){ // loop on selected IO's
       Handle(SALOME_InteractiveObject) IObject = It.Value();
-      if(IObject->hasEntry()){
-       _PTR(SObject) SO = aStudy->FindObjectID(IObject->getEntry());
+      if(IObject->hasEntry()) {
+       _PTR(SObject) aSO = aStudy->FindObjectID(IObject->getEntry());
 
        // disable removal of "SMESH" component object
-       if(SO->FindAttribute(anAttr, "AttributeIOR")){
+       if(aSO->FindAttribute(anAttr, "AttributeIOR")){
          anIOR = anAttr;
          if ( !strcmp( (char*)anIOR->Value().c_str(), engineIOR().latin1() ) )
            continue;
        }
 
-       /* Erase child graphical objects */
-       _PTR(ChildIterator) it = aStudy->NewChildIterator(SO);
-       for(it->InitEx(true); it->More(); it->Next()){
-         _PTR(SObject) CSO = it->Value();
-         if(CSO->FindAttribute(anAttr, "AttributeIOR")){
-           anIOR = anAttr;
+        // put the whole hierarchy of sub-objects of the selected SO into a list and
+        // then treat them all starting from the deepest objects (at list back)
+
+        list< _PTR(SObject) > listSO;
+        listSO.push_back( aSO );
+        list< _PTR(SObject) >::iterator itSO = listSO.begin();
+        for ( ; itSO != listSO.end(); ++itSO ) {
+          _PTR(ChildIterator) it = aStudy->NewChildIterator( *itSO );
+          for (it->InitEx(false); it->More(); it->Next())
+            listSO.push_back( it->Value() );
+        }
+
+        // treat SO's in the list starting from the back
+
+        list< _PTR(SObject) >::reverse_iterator ritSO = listSO.rbegin();
+        for ( ; ritSO != listSO.rend(); ++ritSO ) {
+          _PTR(SObject) SO = *ritSO;
+          if ( !SO ) continue;
+          string anEntry = SO->GetID();
 
+          /** Erase graphical object **/
+         if(SO->FindAttribute(anAttr, "AttributeIOR")){
            QPtrVector<SUIT_ViewWindow> aViews = vm->getViews();
            for(int i = 0; i < nbSf; i++){
              SUIT_ViewWindow *sf = aViews[i];
-             CORBA::String_var anEntry = CSO->GetID().c_str();
-             if(SMESH_Actor* anActor = SMESH::FindActorByEntry(sf,anEntry.in())){
+             if(SMESH_Actor* anActor = SMESH::FindActorByEntry(sf,anEntry.c_str())){
                SMESH::RemoveActor(sf,anActor);
              }
            }
          }
-       }
-
-       /* Erase main graphical object */
-       QPtrVector<SUIT_ViewWindow> aViews = vm->getViews();
-       for(int i = 0; i < nbSf; i++){
-         SUIT_ViewWindow *sf = aViews[i];
-         if(SMESH_Actor* anActor = SMESH::FindActorByEntry(sf,IObject->getEntry())){
-           SMESH::RemoveActor(sf,anActor);
-         }
-       }
 
-       // Remove object(s) from data structures
-       _PTR(SObject) obj = aStudy->FindObjectID(IObject->getEntry());
-       if(obj){
-         SMESH::SMESH_GroupBase_var aGroup = SMESH::SMESH_GroupBase::_narrow( SMESH::SObjectToObject( obj ) );
-         SMESH::SMESH_subMesh_var   aSubMesh = SMESH::SMESH_subMesh::_narrow( SMESH::SObjectToObject( obj ) );
-          QString objType = CheckTypeObject(IObject);
-         if ( !aGroup->_is_nil() ) {                          // DELETE GROUP
-           SMESH::SMESH_Mesh_var aMesh = aGroup->GetMesh();
-           aMesh->RemoveGroup( aGroup );
-         }
-         else if ( !aSubMesh->_is_nil() ) {                   // DELETE SUBMESH
-           SMESH::SMESH_Mesh_var aMesh = aSubMesh->GetFather();
-           aMesh->RemoveSubMesh( aSubMesh );
-         }
-         else if ( objType == "Hypothesis" || objType == "Algorithm" ) {// DELETE HYPOTHESIS
-            SMESH::RemoveHypothesisOrAlgorithmOnMesh(IObject);
-           aStudyBuilder->RemoveObjectWithChildren( obj );
-         }
-         else {// default action: remove SObject from the study
-           // san - it's no use opening a transaction here until UNDO/REDO is provided in SMESH
-           //SUIT_Operation *op = new SALOMEGUI_ImportOperation(myActiveStudy);
-           //op->start();
-           aStudyBuilder->RemoveObjectWithChildren( obj );
-           //op->finish();
-         }
-       }
+          /** Remove an object from data structures **/
+          SMESH::SMESH_GroupBase_var aGroup = SMESH::SMESH_GroupBase::_narrow( SMESH::SObjectToObject( SO ));
+          SMESH::SMESH_subMesh_var   aSubMesh = SMESH::SMESH_subMesh::_narrow( SMESH::SObjectToObject( SO ));
+          if ( !aGroup->_is_nil() ) {                          // DELETE GROUP
+            SMESH::SMESH_Mesh_var aMesh = aGroup->GetMesh();
+            aMesh->RemoveGroup( aGroup );
+          }
+          else if ( !aSubMesh->_is_nil() ) {                   // DELETE SUBMESH
+            SMESH::SMESH_Mesh_var aMesh = aSubMesh->GetFather();
+            aMesh->RemoveSubMesh( aSubMesh );
 
+            _PTR(SObject) aMeshSO = SMESH::FindSObject(aMesh);
+            if (aMeshSO)
+              SMESH::ModifiedMesh(aMeshSO, false);
+          }
+          else {
+            IObject = new SALOME_InteractiveObject
+              ( anEntry.c_str(), engineIOR().latin1(), SO->GetName().c_str() );
+            QString objType = CheckTypeObject(IObject);
+            if ( objType == "Hypothesis" || objType == "Algorithm" ) {// DELETE HYPOTHESIS
+              SMESH::RemoveHypothesisOrAlgorithmOnMesh(IObject);
+              aStudyBuilder->RemoveObjectWithChildren( SO );
+            }
+            else {// default action: remove SObject from the study
+              // san - it's no use opening a transaction here until UNDO/REDO is provided in SMESH
+              //SUIT_Operation *op = new SALOMEGUI_ImportOperation(myActiveStudy);
+              //op->start();
+              aStudyBuilder->RemoveObjectWithChildren( SO );
+              //op->finish();
+            }
+          }
+       } /* listSO back loop */
       } /* IObject->hasEntry() */
     } /* more/next */
     aStudyBuilder->CommitCommand();
@@ -808,10 +826,10 @@ namespace{
 
     SMESHGUI::GetSMESHGUI()->updateObjBrowser();
   }
-}
+//}
 
 extern "C" {
-  Standard_EXPORT CAM_Module* createModule()
+  SMESHGUI_EXPORT CAM_Module* createModule()
   {
     return new SMESHGUI();
   }
@@ -834,6 +852,7 @@ SalomeApp_Module( "SMESH" )
   }
 
   myActiveDialogBox = 0;
+  myFilterLibraryDlg = 0;
   myState = -1;
   myDisplayer = 0;
 
@@ -1209,6 +1228,11 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
          }
        }
       }
+      
+      // PAL13338 -->
+      if ( ( theCommandID==301 || theCommandID==302 ) && !checkLock(aStudy) && !automaticUpdate() ) 
+       SMESH::UpdateView();
+      // PAL13338 <--
 
       if (anAction == SMESH::eErase) {
        SALOME_ListIO l1;
@@ -1216,6 +1240,7 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
       }
       else
        aSel->setSelectedObjects( to_process );
+
       break;
     }
 
@@ -1271,6 +1296,10 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
       if ( vtkwnd ) {
        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;
        }
 
@@ -1335,7 +1364,8 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
          }
          SMESH::RepaintCurrentView();
        }
-      }else{
+      }
+      else{
        SUIT_MessageBox::warn1(desktop(),
                              tr("SMESH_WRN_WARNING"),
                              tr("SMESH_WRN_VIEWER_VTK"),
@@ -1480,6 +1510,20 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
       }
       break;
     }
+  case 417: // Convert mesh to quadratic
+    {
+    startOperation( 417 );
+      /*      if (checkLock(aStudy)) break;
+      if (vtkwnd) {
+       EmitSignalDeactivateDialog();
+       new SMESHGUI_ConvToQuadDlg();
+      } else {
+       SUIT_MessageBox::warn1(desktop(),
+                               tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"),
+                               tr("SMESH_BUT_OK"));
+                              }*/
+      break;
+    }
   case 801:                                     // CREATE GROUP
     {
       if ( !vtkwnd )
@@ -1561,13 +1605,20 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
                }
                updateObjBrowser();
 
-             }catch(const SALOME::SALOME_Exception & S_ex){
+             }
+              catch(const SALOME::SALOME_Exception & S_ex){
                SalomeApp_Tools::QtCatchCorbaException(S_ex);
              }
            }
          }
        }
       }
+      else if(nbSel==0) {
+        SUIT_MessageBox::warn1(desktop(),
+                               tr("SMESH_WRN_WARNING"),
+                               tr("SMESH_WRN_NO_AVAILABLE_DATA"),
+                               tr("SMESH_BUT_OK"));
+      }
       break;
     }
 
@@ -2063,7 +2114,11 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
       aTypes.append( SMESH::FACE );
       aTypes.append( SMESH::VOLUME );
     }
-    new SMESHGUI_FilterLibraryDlg( this, SMESH::GetDesktop( this ), aTypes, SMESHGUI_FilterLibraryDlg::EDIT );
+    if (!myFilterLibraryDlg)
+      myFilterLibraryDlg = new SMESHGUI_FilterLibraryDlg( this, SMESH::GetDesktop( this ), aTypes, SMESHGUI_FilterLibraryDlg::EDIT );
+    else if (myFilterLibraryDlg->isHidden())
+      myFilterLibraryDlg->Init( aTypes, SMESHGUI_FilterLibraryDlg::EDIT );
+    myFilterLibraryDlg->raise();
   }
   break;
 
@@ -2117,12 +2172,14 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
       LightApp_SelectionMgr* mgr = selectionMgr();
       SALOME_ListIO selected; mgr->selectedObjects( selected );
 
-      if (selected.Extent() == 1)      {
-       Handle(SALOME_InteractiveObject) anIObject = selected.First();
-       if(anIObject->hasEntry())
+      SALOME_ListIteratorOfListIO it(selected);
+      for(; it.More(); it.Next()) {
+        Handle(SALOME_InteractiveObject) anIObject = it.Value();
+       if(anIObject->hasEntry()) {
          if(SMESH_Actor *anActor = SMESH::FindActorByEntry(anIObject->getEntry())){
            anActor->SetPointsLabeled( !anActor->GetPointsLabeled() );
          }
+       }
       }
       break;
     }
@@ -2318,7 +2375,7 @@ void SMESHGUI::initialize( CAM_Application* app )
   createSMESHAction( 4051, "RENUM_NODES",     "ICON_DLG_RENUMBERING_NODES" );
   createSMESHAction( 4052, "RENUM_ELEMENTS",  "ICON_DLG_RENUMBERING_ELEMENTS" );
   createSMESHAction( 4061, "TRANS",           "ICON_SMESH_TRANSLATION_VECTOR" );
-  createSMESHAction( 4062, "ROT",             "ICON_DLG_ROTATION" );
+  createSMESHAction( 4062, "ROT",             "ICON_DLG_MESH_ROTATION" );
   createSMESHAction( 4063, "SYM",             "ICON_SMESH_SYMMETRY_PLANE" );
   createSMESHAction( 4064, "SEW",             "ICON_SMESH_SEWING_FREEBORDERS" );
   createSMESHAction( 4065, "MERGE",           "ICON_SMESH_MERGE_NODES" );
@@ -2334,6 +2391,7 @@ void SMESHGUI::initialize( CAM_Application* app )
   createSMESHAction(  414, "REVOLUTION",      "ICON_REVOLUTION" );
   createSMESHAction(  415, "MAP",             "ICON_MAP" );
   createSMESHAction(  416, "EXTRUSION_ALONG", "ICON_EXTRUSION_ALONG" );
+  createSMESHAction(  417, "CONV_TO_QUAD",    "ICON_CONV_TO_QUAD" );
   createSMESHAction(  200, "RESET" );
   createSMESHAction(  201, "SCALAR_BAR_PROP" );
   createSMESHAction(  211, "WIRE",           "ICON_WIRE", 0, true );
@@ -2480,6 +2538,7 @@ void SMESHGUI::initialize( CAM_Application* app )
   createMenu( 416, modifyId, -1 );
   createMenu( 414, modifyId, -1 );
   createMenu( 415, modifyId, -1 );
+  createMenu( 417, modifyId, -1 );
 
   createMenu( 214, viewId, -1 );
 
@@ -2564,6 +2623,7 @@ void SMESHGUI::initialize( CAM_Application* app )
   createTool( 416, modifyTb );
   createTool( 414, modifyTb );
   createTool( 415, modifyTb );
+  createTool( 417, modifyTb );
 
   createTool( 214, dispModeTb );
 
@@ -2741,7 +2801,7 @@ void SMESHGUI::initialize( CAM_Application* app )
 
   popupMgr()->insert( action( 6003 ), anId, -1 ); // FREE_BORDER
   popupMgr()->setRule( action( 6003 ), aMeshInVtkHasEdges, true );
-  popupMgr()->setRule( action( 6003 ), "controlMode = 'eFreeEdges'", false );
+  popupMgr()->setRule( action( 6003 ), "controlMode = 'eFreeBorders'", false );
 
   popupMgr()->insert( action( 6001 ), anId, -1 ); // LENGTH
   popupMgr()->setRule( action( 6001 ), aMeshInVtkHasEdges, true );
@@ -2755,7 +2815,7 @@ void SMESHGUI::initialize( CAM_Application* app )
 
   popupMgr()->insert( action( 6002 ), anId, -1 ); // FREE_EDGE
   popupMgr()->setRule( action( 6002 ), aMeshInVtkHasFaces, true );
-  popupMgr()->setRule( action( 6002 ), "controlMode = 'eFreeBorders'", false );
+  popupMgr()->setRule( action( 6002 ), "controlMode = 'eFreeEdges'", false );
 
   popupMgr()->insert( action( 6018 ), anId, -1 ); // LENGTH_2D
   popupMgr()->setRule( action( 6018 ), aMeshInVtkHasFaces, true );
@@ -2837,6 +2897,11 @@ bool SMESHGUI::activateModule( SUIT_Study* study )
   setMenuShown( true );
   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
+
   return res;
 }
 
@@ -2847,6 +2912,11 @@ 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
+
   return SalomeApp_Module::deactivateModule( study );
 }
 
@@ -2879,7 +2949,7 @@ QString SMESHGUI::engineIOR() const
 {
   CORBA::ORB_var anORB = getApp()->orb();
   CORBA::String_var anIOR = anORB->object_to_string(GetSMESHGen());
-  return anIOR.in();
+  return QString( anIOR.in() );
 }
 
 void SMESHGUI::contextMenuPopup( const QString& client, QPopupMenu* menu, QString& /*title*/ )
@@ -2996,9 +3066,9 @@ void SMESHGUI::createPreferences()
   int fontGr = addPreference( tr( "SMESH_FONT_SCALARBAR" ), sbarTab );
 
   int tfont = addPreference( tr( "SMESH_TITLE" ), fontGr, LightApp_Preferences::Font, "SMESH", "scalar_bar_title_font" );
-  addPreference( tr( "SMESH_TITLE" ), fontGr, LightApp_Preferences::Color, "SMESH", "scalar_bar_title_color" );
+  addPreference( tr( "PREF_TITLE_COLOR" ), fontGr, LightApp_Preferences::Color, "SMESH", "scalar_bar_title_color" );
   int lfont = addPreference( tr( "SMESH_LABELS" ), fontGr, LightApp_Preferences::Font, "SMESH", "scalar_bar_label_font" );
-  addPreference( tr( "SMESH_LABELS" ), fontGr, LightApp_Preferences::Color, "SMESH", "scalar_bar_label_color" );
+  addPreference( tr( "PREF_LABELS_COLOR" ), fontGr, LightApp_Preferences::Color, "SMESH", "scalar_bar_label_color" );
 
   QStringList fam;
   fam.append( tr( "SMESH_FONT_ARIAL" ) );
@@ -3088,8 +3158,6 @@ void SMESHGUI::preferencesChanged( const QString& sect, const QString& name )
       sbW = aResourceMgr->doubleValue("SMESH", "scalar_bar_vertical_width", sbW);
       if(sbX1+sbW > aTol){
        aWarning = "Origin and Size Vertical: X+Width > 1\n";   
-       sbX1=0.01;
-       sbW=0.05;
        aResourceMgr->setValue("SMESH", "scalar_bar_vertical_x", sbX1);
        aResourceMgr->setValue("SMESH", "scalar_bar_vertical_width", sbW);
       }
@@ -3099,8 +3167,6 @@ void SMESHGUI::preferencesChanged( const QString& sect, const QString& name )
       sbH = aResourceMgr->doubleValue("SMESH", "scalar_bar_vertical_height",sbH);
       if(sbY1+sbH > aTol){
        aWarning = "Origin and Size Vertical: Y+Height > 1\n";
-       sbY1=0.01;
-       sbH=0.5;
        aResourceMgr->setValue("SMESH", "scalar_bar_vertical_y", sbY1);
        aResourceMgr->setValue("SMESH", "scalar_bar_vertical_height",sbH);
       }
@@ -3110,8 +3176,8 @@ void SMESHGUI::preferencesChanged( const QString& sect, const QString& name )
       sbW = aResourceMgr->doubleValue("SMESH", "scalar_bar_horizontal_width", sbW);
       if(sbX1+sbW > aTol){
        aWarning = "Origin and Size Horizontal: X+Width > 1\n";
-       sbX1=0.2;
-       sbW=0.6;
+       sbX1=0.01;
+       sbW=0.05;
        aResourceMgr->setValue("SMESH", "scalar_bar_horizontal_x", sbX1);
        aResourceMgr->setValue("SMESH", "scalar_bar_horizontal_width", sbW);
       }
@@ -3122,7 +3188,7 @@ void SMESHGUI::preferencesChanged( const QString& sect, const QString& name )
       if(sbY1+sbH > aTol){
        aWarning = "Origin and Size Horizontal: Y+Height > 1\n";
        sbY1=0.01;
-       sbH=0.12;
+       sbH=0.05;
        aResourceMgr->setValue("SMESH", "scalar_bar_horizontal_y", sbY1);
        aResourceMgr->setValue("SMESH", "scalar_bar_horizontal_height",sbH);
       }
@@ -3210,6 +3276,9 @@ LightApp_Operation* SMESHGUI::createOperation( const int id ) const
     case 704: // Edit mesh/sub-mesh
       op = new SMESHGUI_MeshOp( false );
     break;
+    case 417: //convert to quadratic
+      op = new SMESHGUI_ConvToQuadOp();
+    break;
     default:
     break;
   }
@@ -3239,3 +3308,4 @@ LightApp_Displayer* SMESHGUI::displayer()
     myDisplayer = new SMESHGUI_Displayer( getApp() );
   return myDisplayer;
 }
+