Salome HOME
NPAL16716. Compound: To create the groups of initial meshes.
[modules/smesh.git] / src / SMESHGUI / SMESHGUI_Preferences_ScalarBarDlg.cxx
index 850194b22d767275bd1bfa57f47becd5ce5cc4a1..b17a523ebf13201b94c125bbb9947ae3da79ca93 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
 //
 //
 //
 
 #include "SMESHGUI.h"
 #include "SMESHGUI_VTKUtils.h"
+#include "SMESHGUI_Utils.h"
 
 #include "SMESH_Actor.h"
 
+#include "SUIT_Desktop.h"
 #include "SUIT_ResourceMgr.h"
 
-#include "SalomeApp_SelectionMgr.h"
+#include "LightApp_SelectionMgr.h"
 #include "SALOME_ListIO.hxx"
 
 #include <QtxDblSpinBox.h>
 
 #include <vtkTextProperty.h>
 #include <vtkScalarBarActor.h>
-#include <vtkScalarsToColors.h>
+#include <vtkLookupTable.h>
 
 #define MINIMUM_WIDTH 70
 #define MARGIN_SIZE   11
 #define SPACING_SIZE   6
 
-#define DEF_VER_X  0.01
-#define DEF_VER_Y  0.10
-#define DEF_VER_H  0.80
-#define DEF_VER_W  0.10
-#define DEF_HOR_X  0.20
-#define DEF_HOR_Y  0.01
-#define DEF_HOR_H  0.12
-#define DEF_HOR_W  0.60
-
 using namespace std;
 
 // Only one instance is allowed
@@ -83,11 +76,10 @@ SMESHGUI_Preferences_ScalarBarDlg* SMESHGUI_Preferences_ScalarBarDlg::myDlg = 0;
  *  Gets the only instance of "Scalar Bar Properties" dialog box
  */
 //=================================================================================================
-void SMESHGUI_Preferences_ScalarBarDlg::ScalarBarProperties (QWidget* parent,
-                                                             SalomeApp_SelectionMgr* Sel)
+void SMESHGUI_Preferences_ScalarBarDlg::ScalarBarProperties( SMESHGUI* theModule )
 {
   if (!myDlg) {
-    myDlg = new SMESHGUI_Preferences_ScalarBarDlg (parent, Sel, false);
+    myDlg = new SMESHGUI_Preferences_ScalarBarDlg( theModule, true);
     myDlg->show();
   } else {
     myDlg->show();
@@ -104,10 +96,10 @@ void SMESHGUI_Preferences_ScalarBarDlg::ScalarBarProperties (QWidget* parent,
  *  Opens "Scalar Bar Preferences" dialog box
  */
 //=================================================================================================
-void SMESHGUI_Preferences_ScalarBarDlg::ScalarBarPreferences (QWidget* parent)
+void SMESHGUI_Preferences_ScalarBarDlg::ScalarBarPreferences( SMESHGUI* theModule )
 {
   SMESHGUI_Preferences_ScalarBarDlg* aDlg =
-    new SMESHGUI_Preferences_ScalarBarDlg (parent, 0, true);
+    new SMESHGUI_Preferences_ScalarBarDlg( theModule, false);
   aDlg->exec();
 }
 
@@ -118,17 +110,24 @@ void SMESHGUI_Preferences_ScalarBarDlg::ScalarBarPreferences (QWidget* parent)
  *  Constructor
  */
 //=================================================================================================
-SMESHGUI_Preferences_ScalarBarDlg::SMESHGUI_Preferences_ScalarBarDlg (QWidget* parent,
-                                                                      SalomeApp_SelectionMgr* Sel,
-                                                                      bool modal)
-     : QDialog(parent, 0, modal, WStyle_Customize | WStyle_NormalBorder |
-               WStyle_Title | WStyle_SysMenu | WDestructiveClose)
+SMESHGUI_Preferences_ScalarBarDlg::SMESHGUI_Preferences_ScalarBarDlg( SMESHGUI* theModule, bool property, bool modal )
+     : QDialog( SMESH::GetDesktop( theModule ), 0, modal, WStyle_Customize | WStyle_NormalBorder |
+                WStyle_Title | WStyle_SysMenu | WDestructiveClose ),
+       mySMESHGUI( theModule ),
+       mySelectionMgr( property ? SMESH::GetSelectionMgr( theModule ) : 0 )
 {
+  DEF_VER_X = 0.01;
+  DEF_VER_Y = 0.10;
+  DEF_VER_H = 0.80;
+  DEF_VER_W = 0.10;
+  DEF_HOR_X = 0.20;
+  DEF_HOR_Y = 0.01;
+  DEF_HOR_H = 0.12;
+  DEF_HOR_W = 0.60;
   setName("SMESHGUI_Preferences_ScalarBarDlg");
-  setCaption(Sel ? tr("SMESH_PROPERTIES_SCALARBAR") : tr("SMESH_PREFERENCES_SCALARBAR"));
+  setCaption( property ? tr("SMESH_PROPERTIES_SCALARBAR") : tr("SMESH_PREFERENCES_SCALARBAR"));
   setSizeGripEnabled(TRUE);
 
-  mySelectionMgr = Sel;
   myActor = 0;
 
   /******************************************************************************/
@@ -174,6 +173,7 @@ SMESHGUI_Preferences_ScalarBarDlg::SMESHGUI_Preferences_ScalarBarDlg (QWidget* p
   myFontGrpLayout->setSpacing( SPACING_SIZE ); myFontGrpLayout->setMargin( MARGIN_SIZE );
 
   myTitleColorBtn = new QToolButton( myFontGrp, "myTitleColorBtn" );
+  myTitleColorBtn->setMinimumWidth( 20 );
 
   myTitleFontCombo = new QComboBox( false, myFontGrp, "myTitleFontCombo" );
   myTitleFontCombo->setMinimumWidth( MINIMUM_WIDTH );
@@ -187,6 +187,7 @@ SMESHGUI_Preferences_ScalarBarDlg::SMESHGUI_Preferences_ScalarBarDlg (QWidget* p
   myTitleShadowCheck = new QCheckBox( tr( "SMESH_FONT_SHADOW" ), myFontGrp, "myTitleShadowCheck" );
 
   myLabelsColorBtn = new QToolButton( myFontGrp, "myLabelsColorBtn" );
+  myLabelsColorBtn->setMinimumWidth( 20 );
 
   myLabelsFontCombo = new QComboBox( false, myFontGrp, "myLabelsFontCombo" );
   myLabelsFontCombo->setMinimumWidth( MINIMUM_WIDTH );
@@ -326,86 +327,92 @@ SMESHGUI_Preferences_ScalarBarDlg::SMESHGUI_Preferences_ScalarBarDlg (QWidget* p
   /***************************************************************/
   // Init
   // --> first init from preferences
-  SUIT_ResourceMgr* mgr = SMESHGUI::resourceMgr();
+  SUIT_ResourceMgr* mgr = SMESH::GetResourceMgr( mySMESHGUI );
 
   QColor titleColor (255, 255, 255);
-  if (mgr && mgr->hasValue("SMESH", "ScalarBarTitleColor")) {
+  if (mgr && mgr->hasValue("SMESH", "scalar_bar_title_color")) {
     QStringList aTColor =
-      QStringList::split(":", mgr->stringValue("SMESH", "ScalarBarTitleColor"), false);
+      QStringList::split(":", mgr->stringValue("SMESH", "scalar_bar_title_color"), false);
     titleColor = QColor((aTColor.count() > 0 ? aTColor[0].toInt() : 255),
                         (aTColor.count() > 1 ? aTColor[1].toInt() : 255),
                         (aTColor.count() > 2 ? aTColor[2].toInt() : 255));
   }
   myTitleColorBtn->setPaletteBackgroundColor(titleColor);
   myTitleFontCombo->setCurrentItem(0);
-  if (mgr && mgr->hasValue("SMESH", "ScalarBarTitleFont")) {
-    if (mgr->stringValue("SMESH", "ScalarBarTitleFont") == "Arial")
+  if (mgr && mgr->hasValue("SMESH", "scalar_bar_title_font")) {
+    QFont f = mgr->fontValue( "SMESH", "scalar_bar_title_font" );
+    if( f.family()=="Arial" )
       myTitleFontCombo->setCurrentItem(0);
-    if (mgr->stringValue("SMESH", "ScalarBarTitleFont") == "Courier")
+    if( f.family()=="Courier" )
       myTitleFontCombo->setCurrentItem(1);
-    if (mgr->stringValue("SMESH", "ScalarBarTitleFont") == "Times")
+    if( f.family()=="Times")
       myTitleFontCombo->setCurrentItem(2);
+  
+    myTitleBoldCheck->setChecked  ( f.bold() );
+    myTitleItalicCheck->setChecked( f.italic() );
+    myTitleShadowCheck->setChecked( f.underline() );
   }
-  myTitleBoldCheck->setChecked  (mgr && mgr->stringValue("SMESH", "ScalarBarTitleBold")   == "true");
-  myTitleItalicCheck->setChecked(mgr && mgr->stringValue("SMESH", "ScalarBarTitleItalic") == "true");
-  myTitleShadowCheck->setChecked(mgr && mgr->stringValue("SMESH", "ScalarBarTitleShadow") == "true");
 
   QColor labelColor (255, 255, 255);
-  if (mgr && mgr->hasValue("SMESH", "ScalarBarLabelColor")) {
+  if (mgr && mgr->hasValue("SMESH", "scalar_bar_label_color")) {
     QStringList aLColor =
-      QStringList::split(":", mgr->stringValue("SMESH", "ScalarBarLabelColor"), false);
+      QStringList::split(":", mgr->stringValue("SMESH", "scalar_bar_label_color"), false);
     labelColor = QColor((aLColor.count() > 0 ? aLColor[0].toInt() : 255),
                         (aLColor.count() > 1 ? aLColor[1].toInt() : 255),
                         (aLColor.count() > 2 ? aLColor[2].toInt() : 255));
   }
   myLabelsColorBtn->setPaletteBackgroundColor(labelColor);
   myLabelsFontCombo->setCurrentItem(0);
-  if (mgr && mgr->hasValue("SMESH", "ScalarBarLabelFont")) {
-    if (mgr->stringValue("SMESH", "ScalarBarLabelFont") == "Arial")
+  if (mgr && mgr->hasValue("SMESH", "scalar_bar_label_font")) {
+    QFont f = mgr->fontValue( "SMESH", "scalar_bar_label_font" );
+    if (f.family() == "Arial")
       myLabelsFontCombo->setCurrentItem(0);
-    if (mgr->stringValue("SMESH", "ScalarBarLabelFont") == "Courier")
+    if (f.family() == "Courier")
       myLabelsFontCombo->setCurrentItem(1);
-    if (mgr->stringValue("SMESH", "ScalarBarLabelFont") == "Times")
+    if (f.family() == "Times")
       myLabelsFontCombo->setCurrentItem(2);
+      
+    myLabelsBoldCheck  ->setChecked( f.bold() );
+    myLabelsItalicCheck->setChecked( f.italic() );
+    myLabelsShadowCheck->setChecked( f.underline() );
   }
-  myLabelsBoldCheck  ->setChecked(mgr && mgr->stringValue("SMESH", "ScalarBarLabelBold")   == "true");
-  myLabelsItalicCheck->setChecked(mgr && mgr->stringValue("SMESH", "ScalarBarLabelItalic") == "true");
-  myLabelsShadowCheck->setChecked(mgr && mgr->stringValue("SMESH", "ScalarBarLabelShadow") == "true");
 
   int aNbColors = 64;
-  if (mgr && mgr->hasValue("SMESH", "ScalarBarNbOfColors"))
-    aNbColors = mgr->integerValue("SMESH", "ScalarBarNbOfColors");
+  if (mgr && mgr->hasValue("SMESH", "scalar_bar_num_colors"))
+    aNbColors = mgr->integerValue("SMESH", "scalar_bar_num_colors");
   myColorsSpin->setValue(aNbColors);
 
   int aNbLabels = 5;
-  if (mgr && mgr->hasValue("SMESH", "ScalarBarNbOfLabels"))
-    aNbLabels = mgr->integerValue("SMESH", "ScalarBarNbOfLabels");
+  if (mgr && mgr->hasValue("SMESH", "scalar_bar_num_labels"))
+    aNbLabels = mgr->integerValue("SMESH", "scalar_bar_num_labels");
   myLabelsSpin->setValue(aNbLabels);
 
-  QString aOrientation = (mgr ? mgr->stringValue("SMESH", "ScalarBarOrientation") : "");
-  if (aOrientation == "Horizontal")
+  int aOrientation = ( mgr ? mgr->integerValue( "SMESH", "scalar_bar_orientation", 1 ) : 1 );
+  bool isHoriz = ( aOrientation==1 );
+  if (aOrientation == 1)
     myHorizRadioBtn->setChecked(true);
   else
     myVertRadioBtn->setChecked(true);
   myIniOrientation = myVertRadioBtn->isChecked();
 
-  if (mgr && mgr->hasValue("SMESH", "ScalarBarXPosition"))
-    myIniX = mgr->doubleValue("SMESH", "ScalarBarXPosition");
+  QString name = isHoriz ? "scalar_bar_horizontal_%1" : "scalar_bar_vertical_%1";
+  if (mgr && mgr->hasValue("SMESH", name.arg( "x" )))
+    myIniX = mgr->doubleValue("SMESH", name.arg( "x" ));
   else
     myIniX = myHorizRadioBtn->isChecked() ? DEF_HOR_X : DEF_VER_X;
 
-  if (mgr && mgr->hasValue("SMESH", "ScalarBarYPosition"))
-    myIniY = mgr->doubleValue("SMESH", "ScalarBarYPosition");
+  if (mgr && mgr->hasValue("SMESH", name.arg( "y" )))
+    myIniY = mgr->doubleValue("SMESH", name.arg( "y" ));
   else
     myIniY = myHorizRadioBtn->isChecked() ? DEF_HOR_Y : DEF_VER_Y;
 
-  if (mgr && mgr->hasValue("SMESH", "ScalarBarWidth"))
-    myIniW = mgr->doubleValue("SMESH", "ScalarBarWidth");
+  if (mgr && mgr->hasValue("SMESH", name.arg( "width" )))
+    myIniW = mgr->doubleValue("SMESH", name.arg( "width" ));
   else
     myIniW = myHorizRadioBtn->isChecked() ? DEF_HOR_W : DEF_VER_W;
 
-  if (mgr && mgr->hasValue("SMESH", "ScalarBarHeight"))
-    myIniH = mgr->doubleValue("SMESH", "ScalarBarHeight");
+  if (mgr && mgr->hasValue("SMESH", name.arg( "height" )))
+    myIniH = mgr->doubleValue("SMESH", name.arg( "height" ));
   else
     myIniH = myHorizRadioBtn->isChecked() ? DEF_HOR_H : DEF_VER_H;
 
@@ -429,7 +436,7 @@ SMESHGUI_Preferences_ScalarBarDlg::SMESHGUI_Preferences_ScalarBarDlg (QWidget* p
     connect( myApplyBtn,        SIGNAL( clicked() ), this, SLOT( onApply() ) );
     connect( mySelectionMgr,    SIGNAL( currentSelectionChanged() ), this, SLOT( onSelectionChanged() ) );
   }
-  connect( SMESHGUI::GetSMESHGUI(),  SIGNAL( SignalCloseAllDialogs() ), this, SLOT( onCancel() ) ) ;
+  connect( mySMESHGUI,  SIGNAL( SignalCloseAllDialogs() ), this, SLOT( onCancel() ) ) ;
 }
 
 //=================================================================================================
@@ -513,51 +520,58 @@ bool SMESHGUI_Preferences_ScalarBarDlg::onApply()
 
     double aMin = myMinEdit->text().toDouble();
     double aMax = myMaxEdit->text().toDouble();
-    myScalarBarActor->GetLookupTable()->SetRange( aMin, aMax );
+    vtkLookupTable* myLookupTable =
+      static_cast<vtkLookupTable*>(myScalarBarActor->GetLookupTable());
+    myLookupTable->SetRange( aMin, aMax );
+    myLookupTable->SetNumberOfTableValues(myColorsSpin->value());
+    myLookupTable->Build();
     SMESH::RepaintCurrentView();
   } else {
     // Scalar Bar preferences
-    SUIT_ResourceMgr* mgr = SMESHGUI::resourceMgr();
+    SUIT_ResourceMgr* mgr = SMESH::GetResourceMgr( mySMESHGUI );
     if (!mgr) return false;
 
     QColor titleColor = myTitleColorBtn->paletteBackgroundColor();
-    mgr->setValue("SMESH", "ScalarBarTitleColor",
-                  QString().sprintf("%d:%d:%d", titleColor.red(), titleColor.green(), titleColor.blue()));
+    mgr->setValue("SMESH", "scalar_bar_title_color", titleColor );
+
+    QFont f;
     if (myTitleFontCombo->currentItem() == 0)
-      mgr->setValue("SMESH", "ScalarBarTitleFont", "Arial");
+      f.setFamily( "Arial" );
     else if (myTitleFontCombo->currentItem() == 1)
-      mgr->setValue("SMESH", "ScalarBarTitleFont", "Courier");
+      f.setFamily( "Courier" );
     else
-      mgr->setValue("SMESH", "ScalarBarTitleFont", "Times");
+      f.setFamily( "Times");
 
-    mgr->setValue("SMESH", "ScalarBarTitleBold"  , myTitleBoldCheck  ->isChecked() ? "true" : "false");
-    mgr->setValue("SMESH", "ScalarBarTitleItalic", myTitleItalicCheck->isChecked() ? "true" : "false");
-    mgr->setValue("SMESH", "ScalarBarTitleShadow", myTitleShadowCheck->isChecked() ? "true" : "false");
+    f.setBold( myTitleBoldCheck  ->isChecked() );
+    f.setItalic( myTitleItalicCheck->isChecked() );
+    f.setUnderline( myTitleShadowCheck->isChecked() );
+    mgr->setValue( "SMESH", "scalar_bar_title_font", f );
 
     QColor labelColor = myLabelsColorBtn->paletteBackgroundColor();
-    mgr->setValue("SMESH", "ScalarBarLabelColor",
-                  QString().sprintf("%d:%d:%d", labelColor.red(), labelColor.green(),labelColor. blue()));
+    mgr->setValue("SMESH", "scalar_bar_label_color", labelColor );
 
     if (myLabelsFontCombo->currentItem() == 0)
-      mgr->setValue("SMESH", "ScalarBarLabelFont", "Arial");
+      f.setFamily( "Arial" );
     else if ( myLabelsFontCombo->currentItem() == 1 )
-      mgr->setValue("SMESH", "ScalarBarLabelFont", "Courier");
+      f.setFamily( "Courier");
     else
-      mgr->setValue("SMESH", "ScalarBarLabelFont", "Times");
+      f.setFamily( "Times");
 
-    mgr->setValue("SMESH", "ScalarBarLabelBold",   myLabelsBoldCheck->isChecked()   ? "true" : "false");
-    mgr->setValue("SMESH", "ScalarBarLabelItalic", myLabelsItalicCheck->isChecked() ? "true" : "false");
-    mgr->setValue("SMESH", "ScalarBarLabelShadow", myLabelsShadowCheck->isChecked() ? "true" : "false");
+    f.setBold( myLabelsBoldCheck  ->isChecked() );
+    f.setItalic( myLabelsItalicCheck->isChecked() );
+    f.setUnderline( myLabelsShadowCheck->isChecked() );
+    mgr->setValue( "SMESH", "scalar_bar_label_font", f );
 
-    mgr->setValue("SMESH", "ScalarBarNbOfColors", myColorsSpin->value());
-    mgr->setValue("SMESH", "ScalarBarNbOfLabels", myLabelsSpin->value());
+    mgr->setValue("SMESH", "scalar_bar_num_colors", myColorsSpin->value());
+    mgr->setValue("SMESH", "scalar_bar_num_labels", myLabelsSpin->value());
 
-    mgr->setValue("SMESH", "ScalarBarOrientation", myHorizRadioBtn->isChecked() ? "Horizontal" : "Vertical");
+    mgr->setValue("SMESH", "scalar_bar_orientation", myHorizRadioBtn->isChecked() ? 1 : 0 );
 
-    mgr->setValue("SMESH", "ScalarBarXPosition", myXSpin->value());
-    mgr->setValue("SMESH", "ScalarBarYPosition", myYSpin->value());
-    mgr->setValue("SMESH", "ScalarBarWidth",     myWidthSpin->value());
-    mgr->setValue("SMESH", "ScalarBarHeight",    myHeightSpin->value());
+    QString name = myHorizRadioBtn->isChecked() ? "scalar_bar_horizontal_%1" : "scalar_bar_vertical_%1";
+    mgr->setValue("SMESH", name.arg( "x" ), myXSpin->value());
+    mgr->setValue("SMESH", name.arg( "y" ), myYSpin->value());
+    mgr->setValue("SMESH", name.arg( "width" ),     myWidthSpin->value());
+    mgr->setValue("SMESH", name.arg( "height" ),    myHeightSpin->value());
   }
   return true;
 }
@@ -626,13 +640,13 @@ void SMESHGUI_Preferences_ScalarBarDlg::onSelectionChanged()
          vtkScalarBarActor* myScalarBarActor = myActor->GetScalarBarActor();
 
          if ( myScalarBarActor->GetLookupTable() ) {
-           float *range = myScalarBarActor->GetLookupTable()->GetRange();
-           myMinEdit->setText( QString::number( range[0] ) );
-           myMaxEdit->setText( QString::number( range[1] ) );
+           vtkFloatingPointType *range = myScalarBarActor->GetLookupTable()->GetRange();
+           myMinEdit->setText( QString::number( range[0],'g',12 ) );
+           myMaxEdit->setText( QString::number( range[1],'g',12 ) );
          }
 
          vtkTextProperty* aTitleTextPrp = myScalarBarActor->GetTitleTextProperty();
-         float aTColor[3];
+         vtkFloatingPointType aTColor[3];
          aTitleTextPrp->GetColor( aTColor );
          myTitleColorBtn->setPaletteBackgroundColor( QColor( (int)( aTColor[0]*255 ), (int)( aTColor[1]*255 ), (int)( aTColor[2]*255 ) ) );
          myTitleFontCombo->setCurrentItem( aTitleTextPrp->GetFontFamily() );
@@ -641,7 +655,7 @@ void SMESHGUI_Preferences_ScalarBarDlg::onSelectionChanged()
          myTitleShadowCheck->setChecked( aTitleTextPrp->GetShadow() );
 
          vtkTextProperty* aLabelsTextPrp = myScalarBarActor->GetLabelTextProperty();
-         float aLColor[3];
+         vtkFloatingPointType aLColor[3];
          aLabelsTextPrp->GetColor( aLColor );
          myLabelsColorBtn->setPaletteBackgroundColor( QColor( (int)( aLColor[0]*255 ), (int)( aLColor[1]*255 ), (int)( aLColor[2]*255 ) ) );
          myLabelsFontCombo->setCurrentItem( aLabelsTextPrp->GetFontFamily() );
@@ -745,6 +759,8 @@ void SMESHGUI_Preferences_ScalarBarDlg::setOriginAndSize( const double x,
 //=================================================================================================
 void SMESHGUI_Preferences_ScalarBarDlg::onOrientationChanged()
 {
+  this->initScalarBarFromResources();
+
   int aOrientation = myVertRadioBtn->isChecked();
   if ( aOrientation == myIniOrientation )
     setOriginAndSize( myIniX, myIniY, myIniW, myIniH );
@@ -754,3 +770,41 @@ void SMESHGUI_Preferences_ScalarBarDlg::onOrientationChanged()
                      aOrientation ? DEF_VER_W : DEF_HOR_W,
                      aOrientation ? DEF_VER_H : DEF_HOR_H );
 }
+
+//=================================================================================================
+/*!
+ *  SMESHGUI_Preferences_ScalarBarDlg::initScalarBarFromResources()
+ *
+ *  Rereading vertical and horizontal default positions from resources.
+ */
+//=================================================================================================
+void SMESHGUI_Preferences_ScalarBarDlg::initScalarBarFromResources()
+{
+  SUIT_ResourceMgr* mgr = SMESH::GetResourceMgr( mySMESHGUI );
+  QString name;
+  if (mgr){
+    // initialize from resoources
+    
+    // horizontal
+    name = QString("scalar_bar_horizontal_%1");
+    if (mgr->hasValue("SMESH", name.arg( "x" )))
+      DEF_HOR_X = mgr->doubleValue("SMESH", name.arg( "x" ));
+    if (mgr->hasValue("SMESH", name.arg( "y" )))
+      DEF_HOR_Y = mgr->doubleValue("SMESH", name.arg( "y" ));
+    if (mgr->hasValue("SMESH", name.arg( "width" )))
+      DEF_HOR_W = mgr->doubleValue("SMESH", name.arg( "width" ));
+    if (mgr->hasValue("SMESH", name.arg( "height" )))
+      DEF_HOR_H = mgr->doubleValue("SMESH", name.arg( "height" ));
+
+    // vertical
+    name = QString("scalar_bar_vertical_%1");
+    if (mgr->hasValue("SMESH", name.arg( "x" )))
+      DEF_VER_X = mgr->doubleValue("SMESH", name.arg( "x" ));
+    if (mgr->hasValue("SMESH", name.arg( "y" )))
+      DEF_VER_Y = mgr->doubleValue("SMESH", name.arg( "y" ));
+    if (mgr->hasValue("SMESH", name.arg( "width" )))
+      DEF_VER_W = mgr->doubleValue("SMESH", name.arg( "width" ));
+    if (mgr->hasValue("SMESH", name.arg( "height" )))
+      DEF_VER_H = mgr->doubleValue("SMESH", name.arg( "height" ));
+  }
+}