Salome HOME
0020997: [CEA 420] Problem with VISU preferences
[modules/visu.git] / src / VISUGUI / VisuGUI_Prs3dDlg.cxx
index 58bbb712b12c7ba02a42d63a0bff4f48faf55127..2416f563c546e095ebbb6cdbb0ae40fbe2623b3d 100644 (file)
@@ -1,4 +1,4 @@
-//  Copyright (C) 2007-2008  CEA/DEN, EDF R&D, OPEN CASCADE
+//  Copyright (C) 2007-2010  CEA/DEN, EDF R&D, OPEN CASCADE
 //
 //  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
 //  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
@@ -19,6 +19,7 @@
 //
 //  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
+
 //  VISU VISUGUI : GUI of VISU component
 //  File   : VisuGUI_Prs3dDlg.cxx
 //  Author : Laurent CORNABE & Hubert ROLLAND
@@ -45,6 +46,8 @@
 #include "VISU_Result_i.hh"
 #include "VISU_Prs3dUtils.hh"
 
+#include <SalomeApp_IntSpinBox.h>
+#include <SalomeApp_DoubleSpinBox.h>
 #include "LightApp_Application.h"
 
 #include "SUIT_Session.h"
 #include <QKeyEvent>
 #include <QGridLayout>
 
-#include "QtxDoubleSpinBox.h"
-
 #include <vtkTextProperty.h>
 
-#include <limits.h>
-
-using namespace std;
+#include <limits>
 
 //-----------------------------------------------------------------------
 // Text Preferences Dialog
@@ -97,7 +96,7 @@ VisuGUI_TextPrefDlg::VisuGUI_TextPrefDlg (QWidget* parent)
   QGroupBox* aTitleGrp = new QGroupBox ( tr("LBL_TITLE"), this);
   QVBoxLayout* aVBLay = new QVBoxLayout( aTitleGrp );
 
-  //   edit line  
+  //   edit line
   myTitleEdt = new QLineEdit (aTitleGrp);
   aVBLay->addWidget( myTitleEdt);
 
@@ -109,6 +108,7 @@ VisuGUI_TextPrefDlg::VisuGUI_TextPrefDlg (QWidget* parent)
   aHBLay->setSpacing(5);
 
   myTitleFont = new SVTK_FontWidget (aHBox);
+  myTitleFont->Initialize();
   aHBLay->addWidget( myTitleFont );
 
   aMainLay->addWidget(aTitleGrp);
@@ -123,8 +123,9 @@ VisuGUI_TextPrefDlg::VisuGUI_TextPrefDlg (QWidget* parent)
 
   aHBLay = new QHBoxLayout( aHBox );
   aHBLay->setSpacing(5);
-  
+
   myLabelFont = new SVTK_FontWidget (aHBox);
+  myLabelFont->Initialize();
   aHBLay->addWidget( myLabelFont );
 
   aMainLay->addWidget(aLabelsGrp);
@@ -197,7 +198,8 @@ void VisuGUI_TextPrefDlg::onHelp()
   else {
     SUIT_MessageBox::warning(0, QObject::tr("WRN_WARNING"),
                              QObject::tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
-                             arg(app->resourceMgr()->stringValue("ExternalBrowser", "application")).arg(aHelpFileName),
+                             arg(app->resourceMgr()->stringValue("ExternalBrowser",
+                                                                 "application")).arg(aHelpFileName),
                              QObject::tr("BUT_OK"));
   }
 }
@@ -280,37 +282,41 @@ VisuGUI_BarPrefDlg::VisuGUI_BarPrefDlg( QWidget* parent )
   aMainLay->setMargin( 5 );
 
   // dimensions
-  
+
   QGroupBox* aDimGrp = new QGroupBox( this );
   QGridLayout* aDimGrpLay = new QGridLayout( aDimGrp );
   aDimGrpLay->setSpacing( 5 );
   aDimGrpLay->setMargin( 5 );
 
-  myTitleSizeSpin = new QSpinBox( aDimGrp );
+  myTitleSizeSpin = new SalomeApp_IntSpinBox( aDimGrp );
+  myTitleSizeSpin->setAcceptNames( false );
   myTitleSizeSpin->setRange( 0, 100 );
   myTitleSizeSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
   myTitleSizeSpin->setMinimumWidth( 70 );
   myTitleSizeSpin->setValue( 0 );
   myTitleSizeSpin->setSpecialValueText( tr( "AUTO" ) );
   QLabel* aTitleSizeLbl = new QLabel( tr( "LBL_TITLE_W" ), aDimGrp );
-  
-  myLabelSizeSpin = new QSpinBox( aDimGrp );
+
+  myLabelSizeSpin = new SalomeApp_IntSpinBox( aDimGrp );
+  myLabelSizeSpin->setAcceptNames( false );
   myLabelSizeSpin->setRange( 0, 100 );
   myLabelSizeSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
   myLabelSizeSpin->setMinimumWidth( 70 );
   myLabelSizeSpin->setValue( 0 );
   myLabelSizeSpin->setSpecialValueText( tr( "AUTO" ) );
   QLabel* aLabelSizeLbl = new QLabel( tr( "LBL_LABEL_W" ), aDimGrp );
-  
-  myBarWidthSpin = new QSpinBox( aDimGrp );
+
+  myBarWidthSpin = new SalomeApp_IntSpinBox( aDimGrp );
+  myBarWidthSpin->setAcceptNames( false );
   myBarWidthSpin->setRange( 0, 100 );
   myBarWidthSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
   myBarWidthSpin->setMinimumWidth( 70 );
   myBarWidthSpin->setValue( 0 );
   myBarWidthSpin->setSpecialValueText( tr( "AUTO" ) );
   QLabel* aBarWidthLbl = new QLabel( tr( "LBL_BAR_W" ), aDimGrp );
-  
-  myBarHeightSpin = new QSpinBox( aDimGrp );
+
+  myBarHeightSpin = new SalomeApp_IntSpinBox( aDimGrp );
+  myBarHeightSpin->setAcceptNames( false );
   myBarHeightSpin->setRange( 0, 100 );
   myBarHeightSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
   myBarHeightSpin->setMinimumWidth( 70 );
@@ -321,13 +327,14 @@ VisuGUI_BarPrefDlg::VisuGUI_BarPrefDlg( QWidget* parent )
   // format and units
 
   QLabel* aPrecLbl = new QLabel( tr( "PRECISION" ), aDimGrp );
-  myPrecisionSpin = new QSpinBox( aDimGrp );
+  myPrecisionSpin = new SalomeApp_IntSpinBox( aDimGrp );
+  myPrecisionSpin->setAcceptNames( false );
   myPrecisionSpin->setRange( 1, 100 );
-  
+
   myUnitsChk = new QCheckBox( tr( "LBL_SHOW_UNITS" ), aDimGrp );
-  
+
   // layout
-  
+
   aDimGrpLay->addWidget( aTitleSizeLbl,  0, 0 );
   aDimGrpLay->addWidget( myTitleSizeSpin,   0, 1 );
   aDimGrpLay->addWidget( aLabelSizeLbl,  0, 2 );
@@ -339,7 +346,7 @@ VisuGUI_BarPrefDlg::VisuGUI_BarPrefDlg( QWidget* parent )
   aDimGrpLay->addWidget( aPrecLbl, 2, 0 );
   aDimGrpLay->addWidget( myPrecisionSpin, 2, 1 );
   aDimGrpLay->addWidget( myUnitsChk, 2, 2, 1, 2 );
-  
+
   aMainLay->addWidget( aDimGrp );
 
   // Common buttons ===========================================================
@@ -382,7 +389,7 @@ VisuGUI_BarPrefDlg::VisuGUI_BarPrefDlg( QWidget* parent )
 
 //----------------------------------------------------------------------------
 void VisuGUI_BarPrefDlg::setRatios( int titleRatioSize, int labelRatioWidth,
-                                   int barRatioWidth, int barRatioHeight )
+                                    int barRatioWidth, int barRatioHeight )
 {
   myTitleSizeSpin->setValue( myTitleSize = titleRatioSize );
   myLabelSizeSpin->setValue( myLabelSize = labelRatioWidth );
@@ -393,7 +400,7 @@ void VisuGUI_BarPrefDlg::setRatios( int titleRatioSize, int labelRatioWidth,
 
 //----------------------------------------------------------------------------
 void VisuGUI_BarPrefDlg::getRatios( int& titleRatioSize, int& labelRatioWidth,
-                                   int& barRatioWidth, int& barRatioHeight )
+                                    int& barRatioWidth, int& barRatioHeight )
 {
   titleRatioSize  = myTitleSizeSpin->value();
   labelRatioWidth  = myLabelSizeSpin->value();
@@ -438,10 +445,10 @@ void VisuGUI_BarPrefDlg::onHelp()
   }
   else {
     SUIT_MessageBox::warning( this, tr( "WRN_WARNING" ),
-                             tr( "EXTERNAL_BROWSER_CANNOT_SHOW_PAGE" ).
-                             arg( app->resourceMgr()->stringValue( "ExternalBrowser", 
-                                                                   "application" ) ).
-                             arg( aHelpFileName ) );
+                              tr( "EXTERNAL_BROWSER_CANNOT_SHOW_PAGE" ).
+                              arg( app->resourceMgr()->stringValue( "ExternalBrowser",
+                                                                    "application" ) ).
+                              arg( aHelpFileName ) );
   }
 }
 
@@ -484,18 +491,18 @@ void VisuGUI_BarPrefDlg::accept()
 {
   QString dVal;
   int aBWH = myOrientation == 1 ? myBarWidthSpin->value() : myBarHeightSpin->value();
-  if( ( myLabelSizeSpin->value()+ aBWH ) > 100 ) 
+  if( ( myLabelSizeSpin->value()+ aBWH ) > 100 )
   {
     SUIT_MessageBox::warning( this, tr( "WRN_VISU" ), tr( "MSG_BIG_SCALE" ) );
     return;
-  } 
-  
+  }
+
   if ( myTitleSizeSpin->value() > 100 )
   {
     SUIT_MessageBox::warning( this, tr( "WRN_VISU" ), tr( "MSG_BIG_SCALE_TLT" ) );
     return;
   }
-  
+
   myTitleSize = myTitleSizeSpin->value();
   myLabelSize = myLabelSizeSpin->value();
   myBarWidth = myBarWidthSpin->value();
@@ -531,7 +538,7 @@ void VisuGUI_BarPrefDlg::keyPressEvent( QKeyEvent* e )
   Constructor
 */
 VisuGUI_ScalarBarPane::VisuGUI_ScalarBarPane( QWidget* parent, bool theIsDisplayGaussMetric, bool thePreview )
-  : QWidget( parent ), 
+  : QWidget( parent ),
     myPreviewActor( 0 ),
     myScalarMap( 0 ),
     myScalarMapPL( 0 ),
@@ -549,7 +556,7 @@ VisuGUI_ScalarBarPane::VisuGUI_ScalarBarPane( QWidget* parent, bool theIsDisplay
   myVerLS = aResourceMgr->integerValue("VISU", propertyName + "label_size", 0);
   myVerBW = aResourceMgr->integerValue("VISU", propertyName + "bar_width", 0);
   myVerBH = aResourceMgr->integerValue("VISU", propertyName + "bar_height",0);
-  
+
   propertyName = QString("scalar_bar_horizontal_");
   myHorX  = aResourceMgr->doubleValue("VISU", propertyName + "x", 0.);
   myHorY  = aResourceMgr->doubleValue("VISU", propertyName + "y", 0.);
@@ -596,10 +603,14 @@ VisuGUI_ScalarBarPane::VisuGUI_ScalarBarPane( QWidget* parent, bool theIsDisplay
   RangeGroup->addButton( RBIrange, 1 );
   RBFrange->setChecked( true );
 
+  int aPrecision = qAbs( aResourceMgr->integerValue( "VISU", "visual_data_precision", 0 ) );
+  QDoubleValidator* dv = new QDoubleValidator(this);
+  dv->setDecimals(aPrecision);
+
   MinEdit = new QLineEdit( aGB );
   MinEdit->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
   //MinEdit->setMinimumWidth( 70 );
-  MinEdit->setValidator( new QDoubleValidator(this) );
+  MinEdit->setValidator( dv );
   MinEdit->setText( "0.0" );
   QLabel* MinLabel = new QLabel (tr("LBL_MIN"), aGB);
   MinLabel->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ) );
@@ -608,7 +619,7 @@ VisuGUI_ScalarBarPane::VisuGUI_ScalarBarPane( QWidget* parent, bool theIsDisplay
   MaxEdit = new QLineEdit( aGB );
   MaxEdit->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
   //MaxEdit->setMinimumWidth( 70 );
-  MaxEdit->setValidator( new QDoubleValidator(this) );
+  MaxEdit->setValidator( dv );
   MaxEdit->setText( "0.0" );
   QLabel* MaxLabel = new QLabel (tr("LBL_MAX"), aGB);
   MaxLabel->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ) );
@@ -635,7 +646,8 @@ VisuGUI_ScalarBarPane::VisuGUI_ScalarBarPane( QWidget* parent, bool theIsDisplay
   //ColLabGroupLayout->setMargin( 11 );
 
   QLabel* ColorLabel = new QLabel (tr("LBL_NB_COLORS"), ColLabGroup);
-  ColorSpin = new QSpinBox( ColLabGroup );
+  ColorSpin = new SalomeApp_IntSpinBox( ColLabGroup );
+  ColorSpin->setAcceptNames( false );
   ColorSpin->setMinimum( 2 );
   ColorSpin->setMaximum( 256 );
   ColorSpin->setSingleStep( 1 );
@@ -644,11 +656,12 @@ VisuGUI_ScalarBarPane::VisuGUI_ScalarBarPane( QWidget* parent, bool theIsDisplay
   ColorSpin->setValue( 64 );
 
   QLabel* LabelLabel = new QLabel (tr("LBL_NB_LABELS"), ColLabGroup);
-  LabelSpin = new QSpinBox( ColLabGroup );
+  LabelSpin = new SalomeApp_IntSpinBox( ColLabGroup );
+  LabelSpin->setAcceptNames( false );
   LabelSpin->setMinimum( 2 );
   LabelSpin->setMaximum( 65 );
   LabelSpin->setSingleStep( 1 );
-  
+
   LabelSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
   //LabelSpin->setMinimumWidth( 70 );
   LabelSpin->setValue( 5 );
@@ -684,15 +697,15 @@ VisuGUI_ScalarBarPane::VisuGUI_ScalarBarPane( QWidget* parent, bool theIsDisplay
   //OriginGroupLayout->setMargin( 11 );
 
   QLabel* XLabel = new QLabel (tr("LBL_X"), OriginGroup);
-  XSpin = new QtxDoubleSpinBox( OriginGroup );
-  VISU::initSpinBox(XSpin, 0.0, +1.0);
+  XSpin = new SalomeApp_DoubleSpinBox( OriginGroup );
+  VISU::initSpinBox( XSpin, 0.0, +1.0, .1, "parametric_precision" );
   XSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
   //XSpin->setMinimumWidth( 70 );
   XSpin->setValue( 0.01 );
 
   QLabel* YLabel = new QLabel (tr("LBL_Y"), OriginGroup);
-  YSpin = new QtxDoubleSpinBox( OriginGroup );
-  VISU::initSpinBox(YSpin, 0.0, +1.0);
+  YSpin = new SalomeApp_DoubleSpinBox( OriginGroup );
+  VISU::initSpinBox( YSpin, 0.0, +1.0, .1, "parametric_precision" );  
   YSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
   //YSpin->setMinimumWidth( 70 );
   YSpin->setValue( 0.1 );
@@ -711,15 +724,15 @@ VisuGUI_ScalarBarPane::VisuGUI_ScalarBarPane( QWidget* parent, bool theIsDisplay
   //DimGroupLayout->setMargin( 11 );
 
   QLabel* WidthLabel = new QLabel (tr("LBL_WIDTH"), DimGroup);
-  WidthSpin = new QtxDoubleSpinBox( DimGroup );
-  VISU::initSpinBox(WidthSpin, 0.0, +1.0);
+  WidthSpin = new SalomeApp_DoubleSpinBox( DimGroup );
+  VISU::initSpinBox( WidthSpin, 0.0, +1.0, .1, "parametric_precision" );    
   WidthSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
   //WidthSpin->setMinimumWidth( 70 );
   WidthSpin->setValue( 0.1 );
 
   QLabel* HeightLabel = new QLabel (tr("LBL_HEIGHT"), DimGroup);
-  HeightSpin = new QtxDoubleSpinBox( DimGroup );
-  VISU::initSpinBox(HeightSpin, 0.0, +1.0);
+  HeightSpin = new SalomeApp_DoubleSpinBox( DimGroup );
+  VISU::initSpinBox( HeightSpin, 0.0, +1.0, .1, "parametric_precision" );
   HeightSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
   //HeightSpin->setMinimumWidth( 70 );
   HeightSpin->setValue( 0.8 );
@@ -735,7 +748,7 @@ VisuGUI_ScalarBarPane::VisuGUI_ScalarBarPane( QWidget* parent, bool theIsDisplay
   QHBoxLayout* aVBLay = new QHBoxLayout( aSaveBox );
   aVBLay->addWidget( myTextBtn = new QPushButton("Text properties...", aSaveBox) );
   aVBLay->addWidget( myBarBtn  = new QPushButton("Bar properties...",  aSaveBox) );
-  
+
   aMainLayout->addWidget( myTextDlg = new VisuGUI_TextPrefDlg(this) );
   myTextDlg->setTitleVisible(!thePreview);
   myBarDlg = new VisuGUI_BarPrefDlg(this);
@@ -744,11 +757,11 @@ VisuGUI_ScalarBarPane::VisuGUI_ScalarBarPane( QWidget* parent, bool theIsDisplay
   aMainLayout->addWidget( CheckGroup );
   //QHBoxLayout* CheckGroupLayout = new QHBoxLayout( CheckGroup );
   QGridLayout* CheckGroupLayout = new QGridLayout( CheckGroup );
-  
+
   myPreviewCheck = new QCheckBox(tr("LBL_SHOW_PREVIEW"), CheckGroup);
   myPreviewCheck->setChecked(false);
   CheckGroupLayout->addWidget(myPreviewCheck, 0, 0);
-  
+
   myHideBar = new QCheckBox(tr("HIDE_SCALAR_BAR"), CheckGroup);
   myHideBar->setChecked(false);
   CheckGroupLayout->addWidget(myHideBar, 0, 1);
@@ -775,7 +788,7 @@ VisuGUI_ScalarBarPane::VisuGUI_ScalarBarPane( QWidget* parent, bool theIsDisplay
 
   int lp = aResourceMgr->integerValue( "VISU", propertyName + "scalar_bar_label_precision", 3 );
   myBarDlg->setLabelsPrecision( lp );
-  
+
   myBarDlg->setUnitsVisible(aResourceMgr->booleanValue("VISU", propertyName + "display_units", true));
 
   // signals and slots connections ===========================================
@@ -790,9 +803,9 @@ VisuGUI_ScalarBarPane::VisuGUI_ScalarBarPane( QWidget* parent, bool theIsDisplay
   connect( myTextBtn,      SIGNAL( clicked() ),              this, SLOT( onTextPref() ) );
   connect( myBarBtn,       SIGNAL( clicked() ),              this, SLOT( onBarPref() ) );
   connect( myPreviewCheck, SIGNAL( toggled( bool )),         this, SLOT( onPreviewCheck( bool ) ) );
-  
+
   connect( CBDistr,        SIGNAL( toggled( bool ) ),        this, SLOT( onShowDistribution( bool ) )); // RKV
-  
+
   connect( ColorSpin,      SIGNAL( valueChanged( int ) ),    this, SLOT( updatePreview() ));
   connect( LabelSpin,      SIGNAL( valueChanged( int ) ),    this, SLOT( updatePreview() ));
   connect( WidthSpin,      SIGNAL( valueChanged( double ) ), this, SLOT( updatePreview() ));
@@ -861,10 +874,10 @@ void VisuGUI_ScalarBarPane::storeToResources() {
     }
   else
     aResourceMgr->setValue("VISU", "scalar_range_type", 0);
-  
+
   aResourceMgr->setValue("VISU", "scalar_bar_logarithmic", isLogarithmic());
   aResourceMgr->setValue("VISU", "scalar_bar_show_distribution", isShowDistribution()); // RKV
+
   ////
 
   if (myIsStoreTextProp) {
@@ -879,11 +892,11 @@ void VisuGUI_ScalarBarPane::storeToResources() {
                                     isTitleBold, isTitleItalic, isTitleShadow);
 
     QFont aTitleFont;
-    
+
     aTitleFont.setBold(isTitleBold);
     aTitleFont.setItalic(isTitleItalic);
     aTitleFont.setOverline(isTitleShadow);
-    
+
     QString titleFontFamily;
     switch (aTitleFontFamily) {
     case VTK_ARIAL:
@@ -897,11 +910,11 @@ void VisuGUI_ScalarBarPane::storeToResources() {
       break;
     }
     aTitleFont.setFamily(titleFontFamily);
-    
+
     aResourceMgr->setValue("VISU", "scalar_bar_title_font", aTitleFont);
-    
+
     aResourceMgr->setValue("VISU", "scalar_bar_title_color", aTitleColor);
-    
+
     // "Label"
     QColor aLabelColor (255, 255, 255);
     int aLabelFontFamily = VTK_ARIAL;
@@ -914,7 +927,7 @@ void VisuGUI_ScalarBarPane::storeToResources() {
 
 
     QFont aLabelFont;
-    
+
     aLabelFont.setBold(isLabelBold);
     aLabelFont.setItalic(isLabelItalic);
     aLabelFont.setOverline(isLabelShadow);
@@ -933,7 +946,7 @@ void VisuGUI_ScalarBarPane::storeToResources() {
     }
 
     aLabelFont.setFamily(labelFontFamily);
-    
+
     aResourceMgr->setValue("VISU", "scalar_bar_label_font", aLabelFont);
 
     aResourceMgr->setValue("VISU", "scalar_bar_label_color", aLabelColor);
@@ -985,7 +998,7 @@ void VisuGUI_ScalarBarPane::initFromPrsObject(VISU::ColoredPrs3d_i* thePrs)
     QString anUnit = QString(aUnitNames[i].c_str()).simplified();
     if(anUnit.isNull() || anUnit == "")
       anUnit = "-";
-    
+
     aComponent = aComponent + ", " + anUnit;
 
     myModeCombo->addItem(aComponent);
@@ -998,7 +1011,7 @@ void VisuGUI_ScalarBarPane::initFromPrsObject(VISU::ColoredPrs3d_i* thePrs)
   myModeLbl->setEnabled(isScalarMode);
   myModeCombo->setEnabled(isScalarMode);
 
-  // Gauss Metric option should be visible only if at least one 
+  // Gauss Metric option should be visible only if at least one
   // of mesh values on geometry is based on multiple gauss points
   bool isEnableGaussMetric = false;
   if( myIsDisplayGaussMetric ) {
@@ -1007,7 +1020,7 @@ void VisuGUI_ScalarBarPane::initFromPrsObject(VISU::ColoredPrs3d_i* thePrs)
     if ( anIter != aValField.end() ) {
       VISU::PValForTime aValForTime = anIter->second;
       if( aValForTime && aValForTime->GetMaxNbGauss() > 1 )
-       isEnableGaussMetric = true;
+        isEnableGaussMetric = true;
     }
   }
 
@@ -1027,10 +1040,10 @@ void VisuGUI_ScalarBarPane::initFromPrsObject(VISU::ColoredPrs3d_i* thePrs)
   myTitle = aTitle.in();
 
   setPosAndSize( myScalarMap->GetPosX(),
-                myScalarMap->GetPosY(),
-                myScalarMap->GetWidth(),
-                myScalarMap->GetHeight(),
-                myScalarMap->GetBarOrientation());
+                 myScalarMap->GetPosY(),
+                 myScalarMap->GetWidth(),
+                 myScalarMap->GetHeight(),
+                 myScalarMap->GetBarOrientation());
 
   if(RBvert->isChecked()) {
     myVerTS = myScalarMap->GetTitleSize();
@@ -1109,7 +1122,7 @@ void VisuGUI_ScalarBarPane::createScalarBar()
   myScalarMapPL = VISU_ScalarMapPL::New();
   if(myScalarMap->GetSpecificPL())
     myScalarMapPL->ShallowCopy(myScalarMap->GetSpecificPL(), true);
-  
+
   if ( myBusy ) return;
 
   myBusy = true;
@@ -1126,7 +1139,7 @@ void VisuGUI_ScalarBarPane::createScalarBar()
   myPreviewActor->GetScalarBar()->VisibilityOn();
   myPreviewActor->PickableOff();
   //myPreviewActor->SetBarVisibility(!myHideBar->isChecked());
-  
+
   myScalarMapPL->SetScalarMode(myModeCombo->currentIndex());
   if(isLogarithmic())
     myScalarMapPL->SetScaling(VISU::LOGARITHMIC);
@@ -1145,13 +1158,13 @@ void VisuGUI_ScalarBarPane::createScalarBar()
     myScalarMapPL->SetScalarRange( aRange );
   }
 
-  myScalarMapPL->SetNbColors(sbCol);  
+  myScalarMapPL->SetNbColors(sbCol);
   myScalarMapPL->Update();
-  
+
   aScalarBarActor->SetLookupTable(myScalarMapPL->GetBarTable());
   aScalarBarActor->SetDistribution( myScalarMapPL->GetDistribution() );
   aScalarBarActor->SetDistributionVisibility( isShowDistribution() );
-  
+
   if (!myTextDlg->getTitleText().isEmpty()) {
     VISU::PValForTime aValForTime;
     const VISU::PField& aField = myScalarMap->GetScalarField();
@@ -1161,15 +1174,15 @@ void VisuGUI_ScalarBarPane::createScalarBar()
       aValForTime = anIter->second;
 
     if (aValForTime) {
-      std::strstream aStream;
+      std::stringstream aStream;
       const VISU::TTime& aTime = aValForTime->myTime;
       aStream<< myTextDlg->getTitleText().toLatin1().data() <<" ";
-      if(myBarDlg->isUnitsVisible()) 
-       aStream<<VISU_Convertor::GenerateName(aTime)<<std::ends;
+      if(myBarDlg->isUnitsVisible())
+        aStream<<VISU_Convertor::GenerateName(aTime)<<std::ends;
       else {
-       QString aName;
-       aName.sprintf("%g", aTime.first);
-       aStream << aName.toLatin1().data() << std::ends;
+        QString aName;
+        aName.sprintf("%g", aTime.first);
+        aStream << aName.toLatin1().data() << std::ends;
       }
       std::string aScalarBarTitle = aStream.str();
       aScalarBarActor->SetTitle(aScalarBarTitle.c_str());
@@ -1194,16 +1207,16 @@ void VisuGUI_ScalarBarPane::createScalarBar()
   bool isTitleItalic;
   bool isTitleShadow;
   myTextDlg->myTitleFont->GetData(aTitleColor,aTitleFontFamily,
-                                 isTitleBold,isTitleItalic,isTitleShadow);
+                                  isTitleBold,isTitleItalic,isTitleShadow);
   vtkTextProperty* aTitleProp = aScalarBarActor->GetTitleTextProperty();
   aTitleProp->SetFontFamily(aTitleFontFamily);
   aTitleProp->SetColor(vtkFloatingPointType(aTitleColor.red())/255.,
-                      vtkFloatingPointType(aTitleColor.green())/255.,
-                      vtkFloatingPointType(aTitleColor.blue())/255.);
+                       vtkFloatingPointType(aTitleColor.green())/255.,
+                       vtkFloatingPointType(aTitleColor.blue())/255.);
   (isTitleBold)? aTitleProp->BoldOn() : aTitleProp->BoldOff();
   (isTitleItalic)? aTitleProp->ItalicOn() : aTitleProp->ItalicOff();
   (isTitleShadow)? aTitleProp->ShadowOn() : aTitleProp->ShadowOff();
-  
+
   // label text property
   QColor aLabelColor;
   int aLabelFontFamily;
@@ -1211,17 +1224,17 @@ void VisuGUI_ScalarBarPane::createScalarBar()
   bool isLabelItalic;
   bool isLabelShadow;
   myTextDlg->myLabelFont->GetData(aLabelColor, aLabelFontFamily,
-                                 isLabelBold, isLabelItalic, isLabelShadow);
+                                  isLabelBold, isLabelItalic, isLabelShadow);
   vtkTextProperty* aLabelProp = aScalarBarActor->GetLabelTextProperty();
   aLabelProp->SetFontFamily(aLabelFontFamily);
   aLabelProp->SetColor(vtkFloatingPointType(aLabelColor.red())/255.,
-                      vtkFloatingPointType(aLabelColor.green())/255.,
-                      vtkFloatingPointType(aLabelColor.blue())/255.);
+                       vtkFloatingPointType(aLabelColor.green())/255.,
+                       vtkFloatingPointType(aLabelColor.blue())/255.);
   (isLabelBold)? aLabelProp->BoldOn() : aLabelProp->BoldOff();
   (isLabelItalic)? aLabelProp->ItalicOn() : aLabelProp->ItalicOff();
   (isLabelShadow)? aLabelProp->ShadowOn() : aLabelProp->ShadowOff();
 
-  int VerTS, VerTH, VerLS, VerBW, VerBH;
+  int VerTS, VerLS, VerBW, VerBH;
   myBarDlg->getRatios(VerTS, VerLS, VerBW, VerBH);
   aScalarBarActor->SetRatios(VerTS, VerLS, VerBW, VerBH);
 
@@ -1242,7 +1255,7 @@ void VisuGUI_ScalarBarPane::createScalarBar()
 void VisuGUI_ScalarBarPane::deleteScalarBar()
 {
   if ( myBusy ) return;
-  
+
   if (myPreviewActor == 0) return;
   vtkRenderer* aRend       = myPreviewActor->GetRenderer();
   vtkRenderWindow* aWnd = aRend->GetRenderWindow();
@@ -1319,8 +1332,8 @@ int VisuGUI_ScalarBarPane::storeToPrsObject(VISU::ColoredPrs3d_i* thePrs) {
     myScalarMap->SetShadowTitle(isTitleShadow);
     myScalarMap->SetTitFontType(aTitleFontFamily);
     myScalarMap->SetTitleColor(aTitColor.red()/255.,
-                         aTitColor.green()/255.,
-                         aTitColor.blue()/255.);
+                          aTitColor.green()/255.,
+                          aTitColor.blue()/255.);
 
     // "Label"
     QColor aLblColor (255, 255, 255);
@@ -1337,8 +1350,8 @@ int VisuGUI_ScalarBarPane::storeToPrsObject(VISU::ColoredPrs3d_i* thePrs) {
     myScalarMap->SetShadowLabel(isLabelShadow);
     myScalarMap->SetLblFontType(aLabelFontFamily);
     myScalarMap->SetLabelColor(aLblColor.red()/255.,
-                              aLblColor.green()/255.,
-                              aLblColor.blue()/255.);
+                               aLblColor.green()/255.,
+                               aLblColor.blue()/255.);
     myIsStoreTextProp = false;
   }
 
@@ -1420,7 +1433,7 @@ void VisuGUI_ScalarBarPane::changeRange( int )
 */
 void VisuGUI_ScalarBarPane::XYChanged( double )
 {
-  QtxDoubleSpinBox* snd = (QtxDoubleSpinBox*)sender();
+  SalomeApp_DoubleSpinBox* snd = (SalomeApp_DoubleSpinBox*)sender();
   if ( snd == XSpin ) {
     WidthSpin->setMaximum( 1.0 - XSpin->value() );
   }
@@ -1440,8 +1453,11 @@ void VisuGUI_ScalarBarPane::changeScalarMode( int theMode )
   myScalarMap->SetScalarMode(theMode);
 
   if ( RBFrange->isChecked() ) {
-    MinEdit->setText( QString::number( myScalarMap->GetSourceMin() ) );
-    MaxEdit->setText( QString::number( myScalarMap->GetSourceMax() ) );
+    SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr();
+    int aPrecision = qAbs( aResourceMgr->integerValue("VISU", "visual_data_precision", 0) );
+
+    MinEdit->setText(QString::number(myScalarMap->GetSourceMin(), 'g', aPrecision));
+    MaxEdit->setText(QString::number(myScalarMap->GetSourceMax(), 'g', aPrecision));
   }
 
   updatePreview();
@@ -1457,8 +1473,11 @@ void VisuGUI_ScalarBarPane::changeGaussMetric( int theGaussMetric )
   myScalarMap->SetGaussMetric((VISU::GaussMetric)theGaussMetric);
 
   if ( RBFrange->isChecked() ) {
-    MinEdit->setText( QString::number( myScalarMap->GetSourceMin() ) );
-    MaxEdit->setText( QString::number( myScalarMap->GetSourceMax() ) );
+    SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr();
+    int aPrecision = qAbs( aResourceMgr->integerValue("VISU", "visual_data_precision", 0) );
+
+    MinEdit->setText(QString::number(myScalarMap->GetSourceMin(), 'g', aPrecision));
+    MaxEdit->setText(QString::number(myScalarMap->GetSourceMax(), 'g', aPrecision));
   }
 
   updatePreview();
@@ -1471,8 +1490,12 @@ void VisuGUI_ScalarBarPane::changeGaussMetric( int theGaussMetric )
 */
 void VisuGUI_ScalarBarPane::setRange( double imin, double imax, bool sbRange )
 {
-  MinEdit->setText( QString::number( imin ) );
-  MaxEdit->setText( QString::number( imax ) );
+  SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr();
+  int aPrecision = qAbs( aResourceMgr->integerValue("VISU", "visual_data_precision", 0) );
+
+  MinEdit->setText(QString::number(imin, 'g', aPrecision+1)); // VSR +1 is for 'g' format
+  MaxEdit->setText(QString::number(imax, 'g', aPrecision+1)); // VSR +1 is for 'g' format
+
   if( sbRange )
     RBIrange->setChecked( true );
   else
@@ -1626,8 +1649,8 @@ bool VisuGUI_ScalarBarPane::check()
   if ( RBIrange->isChecked() ) {
     if (minVal >= maxVal) {
       SUIT_MessageBox::warning( this,tr("WRN_VISU"),
-                            tr("MSG_MINMAX_VALUES"),
-                            tr("BUT_OK"));
+                             tr("MSG_MINMAX_VALUES"),
+                             tr("BUT_OK"));
       return false;
     }
   }
@@ -1636,23 +1659,23 @@ bool VisuGUI_ScalarBarPane::check()
   if ( CBLog->isChecked() ) {
     if ( minVal <= 0.0 || maxVal <= 0.0 ) {
       if ( RBIrange->isChecked() ) {
-       SUIT_MessageBox::warning( this,
+        SUIT_MessageBox::warning( this,
                                   tr("WRN_VISU"),
                                   tr("WRN_LOGARITHMIC_RANGE"),
                                   tr("BUT_OK"));
       } else {
-       if ( minVal == 0 || maxVal == 0 )
-         SUIT_MessageBox::warning( this,
-                                 tr("WRN_VISU"),
-                                 tr("WRN_LOGARITHMIC_RANGE"),
-                                 tr("BUT_OK"));
-       else
-         SUIT_MessageBox::warning( this,
-                                   tr("WRN_VISU"),
-                                   tr("WRN_LOGARITHMIC_FIELD_RANGE"),
-                                   tr("BUT_OK"));
-       RBIrange->setChecked(true);
-       changeRange(1);
+        if ( minVal == 0 || maxVal == 0 )
+          SUIT_MessageBox::warning( this,
+                                  tr("WRN_VISU"),
+                                  tr("WRN_LOGARITHMIC_RANGE"),
+                                  tr("BUT_OK"));
+        else
+          SUIT_MessageBox::warning( this,
+                                    tr("WRN_VISU"),
+                                    tr("WRN_LOGARITHMIC_FIELD_RANGE"),
+                                    tr("BUT_OK"));
+        RBIrange->setChecked(true);
+        changeRange(1);
       }
       return false;
     }
@@ -1720,10 +1743,10 @@ void VisuGUI_Prs3dDlg::onHelp()
   }
   else {
     SUIT_MessageBox::warning( this, tr( "WRN_WARNING" ),
-                             tr( "EXTERNAL_BROWSER_CANNOT_SHOW_PAGE" ).
-                             arg( app->resourceMgr()->stringValue( "ExternalBrowser", 
-                                                                  "application" ) ).
-                             arg( aHelpFileName ) );
+                              tr( "EXTERNAL_BROWSER_CANNOT_SHOW_PAGE" ).
+                              arg( app->resourceMgr()->stringValue( "ExternalBrowser",
+                                                                   "application" ) ).
+                              arg( aHelpFileName ) );
   }
 }
 
@@ -1734,7 +1757,7 @@ void VisuGUI_Prs3dDlg::keyPressEvent( QKeyEvent* e )
   QDialog::keyPressEvent( e );
   if ( e->isAccepted() )
     return;
-  
+
   if ( e->key() == Qt::Key_F1 ) {
     e->accept();
     onHelp();
@@ -1757,7 +1780,7 @@ VisuGUI_ScalarBarBaseDlg::~VisuGUI_ScalarBarBaseDlg()
 
 //----------------------------------------------------------------------------
 void VisuGUI_ScalarBarBaseDlg::initFromPrsObject( VISU::ColoredPrs3d_i* thePrs,
-                                                 bool theInit )
+                                                  bool theInit )
 {
   myScalarPane->initFromPrsObject( thePrs );
 }