2009-02-17 10:27:49 +05:00
|
|
|
// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
|
2003-07-10 19:18:22 +06:00
|
|
|
//
|
2009-02-17 10:27:49 +05:00
|
|
|
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
|
2005-06-07 19:22:20 +06:00
|
|
|
// 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
|
|
|
|
//
|
2009-02-17 10:27:49 +05:00
|
|
|
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
2003-07-10 19:18:22 +06:00
|
|
|
//
|
2009-02-17 10:27:49 +05:00
|
|
|
// SMESH SMESHGUI : GUI for SMESH component
|
|
|
|
// File : SMESHGUI_Preferences_ScalarBarDlg.cxx
|
|
|
|
// Author : Nicolas REJNERI, Open CASCADE S.A.S.
|
|
|
|
// SMESH includes
|
2003-07-10 19:18:22 +06:00
|
|
|
//
|
2003-05-19 20:07:00 +06:00
|
|
|
#include "SMESHGUI_Preferences_ScalarBarDlg.h"
|
2004-12-01 15:48:31 +05:00
|
|
|
|
2004-06-18 14:34:31 +06:00
|
|
|
#include "SMESHGUI.h"
|
2004-12-01 15:48:31 +05:00
|
|
|
#include "SMESHGUI_VTKUtils.h"
|
2005-06-08 16:45:19 +06:00
|
|
|
#include "SMESHGUI_Utils.h"
|
2003-05-19 20:07:00 +06:00
|
|
|
|
2009-02-17 10:27:49 +05:00
|
|
|
#include <SMESH_Actor.h>
|
|
|
|
|
|
|
|
// SALOME GUI includes
|
|
|
|
#include <SUIT_Desktop.h>
|
|
|
|
#include <SUIT_ResourceMgr.h>
|
|
|
|
#include <SUIT_Session.h>
|
|
|
|
#include <SUIT_MessageBox.h>
|
|
|
|
|
|
|
|
#include <LightApp_Application.h>
|
|
|
|
#include <LightApp_SelectionMgr.h>
|
|
|
|
#include <SALOME_ListIO.hxx>
|
|
|
|
|
|
|
|
#include <QtxDoubleSpinBox.h>
|
|
|
|
#include <QtxColorButton.h>
|
|
|
|
|
|
|
|
// Qt includes
|
|
|
|
#include <QButtonGroup>
|
|
|
|
#include <QCheckBox>
|
|
|
|
#include <QComboBox>
|
|
|
|
#include <QGroupBox>
|
|
|
|
#include <QLabel>
|
|
|
|
#include <QLineEdit>
|
|
|
|
#include <QPushButton>
|
|
|
|
#include <QRadioButton>
|
|
|
|
#include <QSpinBox>
|
|
|
|
#include <QHBoxLayout>
|
|
|
|
#include <QVBoxLayout>
|
|
|
|
#include <QGridLayout>
|
|
|
|
#include <QDoubleValidator>
|
|
|
|
|
|
|
|
// VTK includes
|
2004-06-18 14:34:31 +06:00
|
|
|
#include <vtkTextProperty.h>
|
|
|
|
#include <vtkScalarBarActor.h>
|
2006-05-06 14:51:48 +06:00
|
|
|
#include <vtkLookupTable.h>
|
2004-06-18 14:34:31 +06:00
|
|
|
|
|
|
|
#define MINIMUM_WIDTH 70
|
|
|
|
#define MARGIN_SIZE 11
|
|
|
|
#define SPACING_SIZE 6
|
|
|
|
|
|
|
|
// Only one instance is allowed
|
|
|
|
SMESHGUI_Preferences_ScalarBarDlg* SMESHGUI_Preferences_ScalarBarDlg::myDlg = 0;
|
|
|
|
|
|
|
|
//=================================================================================================
|
|
|
|
/*!
|
|
|
|
* SMESHGUI_Preferences_ScalarBarDlg::ScalarBarProperties
|
|
|
|
*
|
|
|
|
* Gets the only instance of "Scalar Bar Properties" dialog box
|
|
|
|
*/
|
|
|
|
//=================================================================================================
|
2005-06-08 16:45:19 +06:00
|
|
|
void SMESHGUI_Preferences_ScalarBarDlg::ScalarBarProperties( SMESHGUI* theModule )
|
2004-06-18 14:34:31 +06:00
|
|
|
{
|
2005-06-07 19:22:20 +06:00
|
|
|
if (!myDlg) {
|
2009-02-17 10:27:49 +05:00
|
|
|
myDlg = new SMESHGUI_Preferences_ScalarBarDlg( theModule );
|
2004-06-18 14:34:31 +06:00
|
|
|
myDlg->show();
|
2005-06-07 19:22:20 +06:00
|
|
|
} else {
|
2004-06-18 14:34:31 +06:00
|
|
|
myDlg->show();
|
|
|
|
myDlg->raise();
|
2009-02-17 10:27:49 +05:00
|
|
|
myDlg->activateWindow();
|
2004-06-18 14:34:31 +06:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//=================================================================================================
|
|
|
|
/*!
|
|
|
|
* SMESHGUI_Preferences_ScalarBarDlg::SMESHGUI_Preferences_ScalarBarDlg
|
2003-05-19 20:07:00 +06:00
|
|
|
*
|
2004-06-18 14:34:31 +06:00
|
|
|
* Constructor
|
2003-05-19 20:07:00 +06:00
|
|
|
*/
|
2004-06-18 14:34:31 +06:00
|
|
|
//=================================================================================================
|
2009-02-17 10:27:49 +05:00
|
|
|
SMESHGUI_Preferences_ScalarBarDlg::SMESHGUI_Preferences_ScalarBarDlg( SMESHGUI* theModule )
|
|
|
|
: QDialog( SMESH::GetDesktop( theModule ) ),
|
|
|
|
mySMESHGUI( theModule ),
|
|
|
|
mySelectionMgr( SMESH::GetSelectionMgr( theModule ) )
|
2003-05-19 20:07:00 +06:00
|
|
|
{
|
2006-03-13 20:29:49 +05:00
|
|
|
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;
|
2009-02-17 10:27:49 +05:00
|
|
|
|
|
|
|
setModal( false );
|
|
|
|
setAttribute( Qt::WA_DeleteOnClose, true );
|
|
|
|
setWindowTitle( tr("SMESH_PROPERTIES_SCALARBAR") );
|
|
|
|
setSizeGripEnabled(true);
|
2004-06-18 14:34:31 +06:00
|
|
|
|
|
|
|
myActor = 0;
|
|
|
|
|
|
|
|
/******************************************************************************/
|
|
|
|
// Top layout
|
2009-02-17 10:27:49 +05:00
|
|
|
QVBoxLayout* aTopLayout = new QVBoxLayout( this );
|
2004-06-18 14:34:31 +06:00
|
|
|
aTopLayout->setSpacing( SPACING_SIZE ); aTopLayout->setMargin( MARGIN_SIZE );
|
|
|
|
|
|
|
|
/******************************************************************************/
|
|
|
|
// Scalar range
|
2009-02-17 10:27:49 +05:00
|
|
|
myRangeGrp = new QGroupBox ( tr( "SMESH_RANGE_SCALARBAR" ), this );
|
|
|
|
QHBoxLayout* myRangeGrpLayout = new QHBoxLayout( myRangeGrp );
|
|
|
|
myRangeGrpLayout->setSpacing( SPACING_SIZE ); myRangeGrpLayout->setMargin( MARGIN_SIZE );
|
|
|
|
|
|
|
|
myMinEdit = new QLineEdit( myRangeGrp );
|
|
|
|
myMinEdit->setMinimumWidth( MINIMUM_WIDTH );
|
|
|
|
myMinEdit->setValidator( new QDoubleValidator( this ) );
|
|
|
|
|
|
|
|
myMaxEdit = new QLineEdit( myRangeGrp );
|
|
|
|
myMaxEdit->setMinimumWidth( MINIMUM_WIDTH );
|
|
|
|
myMaxEdit->setValidator( new QDoubleValidator( this ) );
|
|
|
|
|
|
|
|
myRangeGrpLayout->addWidget( new QLabel( tr( "SMESH_RANGE_MIN" ), myRangeGrp ) );
|
|
|
|
myRangeGrpLayout->addWidget( myMinEdit );
|
|
|
|
myRangeGrpLayout->addWidget( new QLabel( tr( "SMESH_RANGE_MAX" ), myRangeGrp ) );
|
|
|
|
myRangeGrpLayout->addWidget( myMaxEdit );
|
|
|
|
|
|
|
|
aTopLayout->addWidget( myRangeGrp );
|
2004-06-18 14:34:31 +06:00
|
|
|
|
|
|
|
/******************************************************************************/
|
|
|
|
// Text properties
|
2009-02-17 10:27:49 +05:00
|
|
|
myFontGrp = new QGroupBox ( tr( "SMESH_FONT_SCALARBAR" ), this );
|
|
|
|
QGridLayout* myFontGrpLayout = new QGridLayout( myFontGrp );
|
2004-06-18 14:34:31 +06:00
|
|
|
myFontGrpLayout->setSpacing( SPACING_SIZE ); myFontGrpLayout->setMargin( MARGIN_SIZE );
|
2005-06-07 19:22:20 +06:00
|
|
|
|
2009-02-17 10:27:49 +05:00
|
|
|
myTitleColorBtn = new QtxColorButton( myFontGrp );
|
2005-06-07 19:22:20 +06:00
|
|
|
|
2009-02-17 10:27:49 +05:00
|
|
|
myTitleFontCombo = new QComboBox( myFontGrp );
|
2004-06-18 14:34:31 +06:00
|
|
|
myTitleFontCombo->setMinimumWidth( MINIMUM_WIDTH );
|
|
|
|
myTitleFontCombo->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
|
2009-02-17 10:27:49 +05:00
|
|
|
myTitleFontCombo->addItem( tr( "SMESH_FONT_ARIAL" ) );
|
|
|
|
myTitleFontCombo->addItem( tr( "SMESH_FONT_COURIER" ) );
|
|
|
|
myTitleFontCombo->addItem( tr( "SMESH_FONT_TIMES" ) );
|
2005-06-07 19:22:20 +06:00
|
|
|
|
2009-02-17 10:27:49 +05:00
|
|
|
myTitleBoldCheck = new QCheckBox( tr( "SMESH_FONT_BOLD" ), myFontGrp );
|
|
|
|
myTitleItalicCheck = new QCheckBox( tr( "SMESH_FONT_ITALIC" ), myFontGrp );
|
|
|
|
myTitleShadowCheck = new QCheckBox( tr( "SMESH_FONT_SHADOW" ), myFontGrp );
|
2004-06-18 14:34:31 +06:00
|
|
|
|
2009-02-17 10:27:49 +05:00
|
|
|
myLabelsColorBtn = new QtxColorButton( myFontGrp );
|
2005-06-07 19:22:20 +06:00
|
|
|
|
2009-02-17 10:27:49 +05:00
|
|
|
myLabelsFontCombo = new QComboBox( myFontGrp );
|
2004-06-18 14:34:31 +06:00
|
|
|
myLabelsFontCombo->setMinimumWidth( MINIMUM_WIDTH );
|
|
|
|
myLabelsFontCombo->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
|
2009-02-17 10:27:49 +05:00
|
|
|
myLabelsFontCombo->addItem( tr( "SMESH_FONT_ARIAL" ) );
|
|
|
|
myLabelsFontCombo->addItem( tr( "SMESH_FONT_COURIER" ) );
|
|
|
|
myLabelsFontCombo->addItem( tr( "SMESH_FONT_TIMES" ) );
|
2005-06-07 19:22:20 +06:00
|
|
|
|
2009-02-17 10:27:49 +05:00
|
|
|
myLabelsBoldCheck = new QCheckBox( tr( "SMESH_FONT_BOLD" ), myFontGrp );
|
|
|
|
myLabelsItalicCheck = new QCheckBox( tr( "SMESH_FONT_ITALIC" ), myFontGrp );
|
|
|
|
myLabelsShadowCheck = new QCheckBox( tr( "SMESH_FONT_SHADOW" ), myFontGrp );
|
2004-06-18 14:34:31 +06:00
|
|
|
|
2009-02-17 10:27:49 +05:00
|
|
|
myFontGrpLayout->addWidget( new QLabel( tr( "SMESH_TITLE" ), myFontGrp ), 0, 0 );
|
2004-06-18 14:34:31 +06:00
|
|
|
myFontGrpLayout->addWidget( myTitleColorBtn, 0, 1 );
|
|
|
|
myFontGrpLayout->addWidget( myTitleFontCombo, 0, 2 );
|
|
|
|
myFontGrpLayout->addWidget( myTitleBoldCheck, 0, 3 );
|
|
|
|
myFontGrpLayout->addWidget( myTitleItalicCheck, 0, 4 );
|
|
|
|
myFontGrpLayout->addWidget( myTitleShadowCheck, 0, 5 );
|
2005-06-07 19:22:20 +06:00
|
|
|
|
2009-02-17 10:27:49 +05:00
|
|
|
myFontGrpLayout->addWidget( new QLabel( tr( "SMESH_LABELS" ), myFontGrp ), 1, 0 );
|
2004-06-18 14:34:31 +06:00
|
|
|
myFontGrpLayout->addWidget( myLabelsColorBtn, 1, 1 );
|
|
|
|
myFontGrpLayout->addWidget( myLabelsFontCombo, 1, 2 );
|
|
|
|
myFontGrpLayout->addWidget( myLabelsBoldCheck, 1, 3 );
|
|
|
|
myFontGrpLayout->addWidget( myLabelsItalicCheck, 1, 4 );
|
|
|
|
myFontGrpLayout->addWidget( myLabelsShadowCheck, 1, 5 );
|
|
|
|
|
2009-02-17 10:27:49 +05:00
|
|
|
aTopLayout->addWidget( myFontGrp );
|
2004-06-18 14:34:31 +06:00
|
|
|
|
|
|
|
/******************************************************************************/
|
|
|
|
// Labels & Colors
|
2009-02-17 10:27:49 +05:00
|
|
|
myLabColorGrp = new QGroupBox ( tr( "SMESH_LABELS_COLORS_SCALARBAR" ), this );
|
|
|
|
QHBoxLayout* myLabColorGrpLayout = new QHBoxLayout( myLabColorGrp );
|
2004-06-18 14:34:31 +06:00
|
|
|
myLabColorGrpLayout->setSpacing( SPACING_SIZE ); myLabColorGrpLayout->setMargin( MARGIN_SIZE );
|
2005-06-07 19:22:20 +06:00
|
|
|
|
2009-02-17 10:27:49 +05:00
|
|
|
myColorsSpin = new QSpinBox( myLabColorGrp );
|
|
|
|
myColorsSpin->setRange( 2, 256 );
|
|
|
|
myColorsSpin->setSingleStep( 1 );
|
2004-06-18 14:34:31 +06:00
|
|
|
myColorsSpin->setMinimumWidth( MINIMUM_WIDTH );
|
|
|
|
myColorsSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
|
|
|
|
|
2009-02-17 10:27:49 +05:00
|
|
|
myLabelsSpin = new QSpinBox( myLabColorGrp );
|
|
|
|
myLabelsSpin->setRange( 2, 65 );
|
|
|
|
myLabelsSpin->setSingleStep( 1 );
|
2004-06-18 14:34:31 +06:00
|
|
|
myLabelsSpin->setMinimumWidth( MINIMUM_WIDTH );
|
|
|
|
myLabelsSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
|
|
|
|
|
2009-02-17 10:27:49 +05:00
|
|
|
myLabColorGrpLayout->addWidget( new QLabel( tr( "SMESH_NUMBEROFCOLORS" ), myLabColorGrp ) );
|
|
|
|
myLabColorGrpLayout->addWidget( myColorsSpin );
|
|
|
|
myLabColorGrpLayout->addWidget( new QLabel( tr( "SMESH_NUMBEROFLABELS" ), myLabColorGrp ) );
|
|
|
|
myLabColorGrpLayout->addWidget( myLabelsSpin );
|
2004-06-18 14:34:31 +06:00
|
|
|
|
2009-02-17 10:27:49 +05:00
|
|
|
aTopLayout->addWidget( myLabColorGrp );
|
2004-06-18 14:34:31 +06:00
|
|
|
|
|
|
|
/******************************************************************************/
|
|
|
|
// Orientation
|
2009-02-17 10:27:49 +05:00
|
|
|
myOrientationGrp = new QGroupBox ( tr( "SMESH_ORIENTATION" ), this );
|
|
|
|
QButtonGroup* aOrientationGrp = new QButtonGroup( this );
|
|
|
|
QHBoxLayout* myOrientationGrpLayout = new QHBoxLayout( myOrientationGrp );
|
2004-06-18 14:34:31 +06:00
|
|
|
myOrientationGrpLayout->setSpacing( SPACING_SIZE ); myOrientationGrpLayout->setMargin( MARGIN_SIZE );
|
2005-06-07 19:22:20 +06:00
|
|
|
|
2009-02-17 10:27:49 +05:00
|
|
|
myVertRadioBtn = new QRadioButton( tr( "SMESH_VERTICAL" ), myOrientationGrp );
|
|
|
|
myHorizRadioBtn = new QRadioButton( tr( "SMESH_HORIZONTAL" ), myOrientationGrp );
|
2004-06-18 14:34:31 +06:00
|
|
|
myVertRadioBtn->setChecked( true );
|
|
|
|
|
2009-02-17 10:27:49 +05:00
|
|
|
myOrientationGrpLayout->addWidget( myVertRadioBtn );
|
|
|
|
myOrientationGrpLayout->addWidget( myHorizRadioBtn );
|
|
|
|
aOrientationGrp->addButton(myVertRadioBtn);
|
|
|
|
aOrientationGrp->addButton(myHorizRadioBtn);
|
2004-06-18 14:34:31 +06:00
|
|
|
|
2009-02-17 10:27:49 +05:00
|
|
|
aTopLayout->addWidget( myOrientationGrp );
|
2004-06-18 14:34:31 +06:00
|
|
|
|
|
|
|
/******************************************************************************/
|
|
|
|
// Position & Size
|
2009-02-17 10:27:49 +05:00
|
|
|
myOriginDimGrp = new QGroupBox ( tr("SMESH_POSITION_SIZE_SCALARBAR"), this );
|
|
|
|
QGridLayout* myOriginDimGrpLayout = new QGridLayout( myOriginDimGrp );
|
2004-06-18 14:34:31 +06:00
|
|
|
myOriginDimGrpLayout->setSpacing( SPACING_SIZE ); myOriginDimGrpLayout->setMargin( MARGIN_SIZE );
|
2005-06-07 19:22:20 +06:00
|
|
|
|
2009-02-17 10:27:49 +05:00
|
|
|
myXSpin = new QtxDoubleSpinBox (0.0, 1.0, 0.1, myOriginDimGrp);
|
2004-06-18 14:34:31 +06:00
|
|
|
myXSpin->setMinimumWidth( MINIMUM_WIDTH );
|
|
|
|
myXSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
|
|
|
|
|
2009-02-17 10:27:49 +05:00
|
|
|
myYSpin = new QtxDoubleSpinBox(0.0, 1.0, 0.1, myOriginDimGrp);
|
2004-06-18 14:34:31 +06:00
|
|
|
myYSpin->setMinimumWidth( MINIMUM_WIDTH );
|
|
|
|
myYSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
|
|
|
|
|
2009-02-17 10:27:49 +05:00
|
|
|
myWidthSpin = new QtxDoubleSpinBox(0.0, 1.0, 0.1, myOriginDimGrp);
|
2004-06-18 14:34:31 +06:00
|
|
|
myWidthSpin->setMinimumWidth( MINIMUM_WIDTH );
|
|
|
|
myWidthSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
|
|
|
|
|
2009-02-17 10:27:49 +05:00
|
|
|
myHeightSpin = new QtxDoubleSpinBox(0.0, 1.0, 0.1, myOriginDimGrp);
|
2004-06-18 14:34:31 +06:00
|
|
|
myHeightSpin->setMinimumWidth( MINIMUM_WIDTH );
|
|
|
|
myHeightSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
|
|
|
|
|
2009-02-17 10:27:49 +05:00
|
|
|
myOriginDimGrpLayout->addWidget( new QLabel( tr( "SMESH_X_SCALARBAR" ), myOriginDimGrp ), 0, 0 );
|
2004-06-18 14:34:31 +06:00
|
|
|
myOriginDimGrpLayout->addWidget( myXSpin, 0, 1 );
|
2009-02-17 10:27:49 +05:00
|
|
|
myOriginDimGrpLayout->addWidget( new QLabel( tr( "SMESH_Y_SCALARBAR" ), myOriginDimGrp ), 0, 2 );
|
2004-06-18 14:34:31 +06:00
|
|
|
myOriginDimGrpLayout->addWidget( myYSpin, 0, 3 );
|
2009-02-17 10:27:49 +05:00
|
|
|
myOriginDimGrpLayout->addWidget( new QLabel( tr( "SMESH_WIDTH" ), myOriginDimGrp ), 1, 0 );
|
2004-06-18 14:34:31 +06:00
|
|
|
myOriginDimGrpLayout->addWidget( myWidthSpin, 1, 1 );
|
2009-02-17 10:27:49 +05:00
|
|
|
myOriginDimGrpLayout->addWidget( new QLabel( tr( "SMESH_HEIGHT" ), myOriginDimGrp ), 1, 2 );
|
2004-06-18 14:34:31 +06:00
|
|
|
myOriginDimGrpLayout->addWidget( myHeightSpin, 1, 3 );
|
|
|
|
|
2009-02-17 10:27:49 +05:00
|
|
|
aTopLayout->addWidget( myOriginDimGrp );
|
2004-06-18 14:34:31 +06:00
|
|
|
|
|
|
|
/***************************************************************/
|
|
|
|
// Common buttons
|
2009-02-17 10:27:49 +05:00
|
|
|
myButtonGrp = new QGroupBox( this );
|
|
|
|
QHBoxLayout* myButtonGrpLayout = new QHBoxLayout( myButtonGrp );
|
2004-06-18 14:34:31 +06:00
|
|
|
myButtonGrpLayout->setSpacing( SPACING_SIZE ); myButtonGrpLayout->setMargin( MARGIN_SIZE );
|
|
|
|
|
2009-02-17 10:27:49 +05:00
|
|
|
myOkBtn = new QPushButton( tr( "SMESH_BUT_APPLY_AND_CLOSE" ), myButtonGrp );
|
|
|
|
myOkBtn->setAutoDefault( true ); myOkBtn->setDefault( true );
|
|
|
|
myApplyBtn = new QPushButton( tr( "SMESH_BUT_APPLY" ), myButtonGrp );
|
|
|
|
myApplyBtn->setAutoDefault( true );
|
|
|
|
myCancelBtn = new QPushButton( tr( "SMESH_BUT_CLOSE" ), myButtonGrp );
|
|
|
|
myCancelBtn->setAutoDefault( true );
|
|
|
|
myHelpBtn = new QPushButton( tr("SMESH_BUT_HELP"), myButtonGrp );
|
|
|
|
myHelpBtn->setAutoDefault(true);
|
|
|
|
|
2004-06-18 14:34:31 +06:00
|
|
|
myButtonGrpLayout->addWidget( myOkBtn );
|
2009-02-17 10:27:49 +05:00
|
|
|
myButtonGrpLayout->addSpacing( 10 );
|
|
|
|
myButtonGrpLayout->addWidget( myApplyBtn );
|
|
|
|
myButtonGrpLayout->addSpacing( 10 );
|
2004-06-18 14:34:31 +06:00
|
|
|
myButtonGrpLayout->addStretch();
|
|
|
|
myButtonGrpLayout->addWidget( myCancelBtn );
|
2009-02-17 10:27:49 +05:00
|
|
|
myButtonGrpLayout->addWidget( myHelpBtn );
|
2004-06-18 14:34:31 +06:00
|
|
|
|
2009-02-17 10:27:49 +05:00
|
|
|
aTopLayout->addWidget( myButtonGrp );
|
2004-06-18 14:34:31 +06:00
|
|
|
|
|
|
|
/***************************************************************/
|
|
|
|
// Init
|
|
|
|
// --> first init from preferences
|
2005-06-08 16:45:19 +06:00
|
|
|
SUIT_ResourceMgr* mgr = SMESH::GetResourceMgr( mySMESHGUI );
|
2005-06-07 19:22:20 +06:00
|
|
|
|
2009-02-17 10:27:49 +05:00
|
|
|
QColor titleColor = mgr->colorValue("SMESH", "scalar_bar_title_color",
|
|
|
|
QColor(255, 255, 255));
|
|
|
|
myTitleColorBtn->setColor(titleColor);
|
|
|
|
myTitleFontCombo->setCurrentIndex(0);
|
|
|
|
if (mgr->hasValue("SMESH", "scalar_bar_title_font")) {
|
2005-07-25 12:50:07 +06:00
|
|
|
QFont f = mgr->fontValue( "SMESH", "scalar_bar_title_font" );
|
|
|
|
if( f.family()=="Arial" )
|
2009-02-17 10:27:49 +05:00
|
|
|
myTitleFontCombo->setCurrentIndex(0);
|
2005-07-25 12:50:07 +06:00
|
|
|
if( f.family()=="Courier" )
|
2009-02-17 10:27:49 +05:00
|
|
|
myTitleFontCombo->setCurrentIndex(1);
|
2005-07-25 12:50:07 +06:00
|
|
|
if( f.family()=="Times")
|
2009-02-17 10:27:49 +05:00
|
|
|
myTitleFontCombo->setCurrentIndex(2);
|
|
|
|
|
2005-07-25 12:50:07 +06:00
|
|
|
myTitleBoldCheck->setChecked ( f.bold() );
|
|
|
|
myTitleItalicCheck->setChecked( f.italic() );
|
2009-02-17 10:27:49 +05:00
|
|
|
myTitleShadowCheck->setChecked( f.overline() );
|
2004-06-18 14:34:31 +06:00
|
|
|
}
|
2009-02-17 10:27:49 +05:00
|
|
|
|
|
|
|
QColor labelColor = mgr->colorValue("SMESH", "scalar_bar_label_color",
|
|
|
|
QColor(255, 255, 255));
|
|
|
|
myLabelsColorBtn->setColor(labelColor);
|
|
|
|
myLabelsFontCombo->setCurrentIndex(0);
|
|
|
|
if (mgr->hasValue("SMESH", "scalar_bar_label_font")) {
|
2005-07-25 12:50:07 +06:00
|
|
|
QFont f = mgr->fontValue( "SMESH", "scalar_bar_label_font" );
|
|
|
|
if (f.family() == "Arial")
|
2009-02-17 10:27:49 +05:00
|
|
|
myLabelsFontCombo->setCurrentIndex(0);
|
2005-07-25 12:50:07 +06:00
|
|
|
if (f.family() == "Courier")
|
2009-02-17 10:27:49 +05:00
|
|
|
myLabelsFontCombo->setCurrentIndex(1);
|
2005-07-25 12:50:07 +06:00
|
|
|
if (f.family() == "Times")
|
2009-02-17 10:27:49 +05:00
|
|
|
myLabelsFontCombo->setCurrentIndex(2);
|
2005-07-25 12:50:07 +06:00
|
|
|
|
|
|
|
myLabelsBoldCheck ->setChecked( f.bold() );
|
|
|
|
myLabelsItalicCheck->setChecked( f.italic() );
|
2009-02-17 10:27:49 +05:00
|
|
|
myLabelsShadowCheck->setChecked( f.overline() );
|
2004-06-18 14:34:31 +06:00
|
|
|
}
|
|
|
|
|
2009-02-17 10:27:49 +05:00
|
|
|
int aNbColors = mgr->integerValue("SMESH", "scalar_bar_num_colors", 64);
|
2005-06-07 19:22:20 +06:00
|
|
|
myColorsSpin->setValue(aNbColors);
|
|
|
|
|
2009-02-17 10:27:49 +05:00
|
|
|
int aNbLabels = mgr->integerValue("SMESH", "scalar_bar_num_labels", 5);
|
2005-06-07 19:22:20 +06:00
|
|
|
myLabelsSpin->setValue(aNbLabels);
|
2004-06-18 14:34:31 +06:00
|
|
|
|
2009-02-17 10:27:49 +05:00
|
|
|
int aOrientation = mgr->integerValue( "SMESH", "scalar_bar_orientation", 1 );
|
|
|
|
bool isHoriz = aOrientation == 1;
|
|
|
|
if (isHoriz)
|
2005-06-07 19:22:20 +06:00
|
|
|
myHorizRadioBtn->setChecked(true);
|
2004-06-18 14:34:31 +06:00
|
|
|
else
|
2005-06-07 19:22:20 +06:00
|
|
|
myVertRadioBtn->setChecked(true);
|
2004-06-18 14:34:31 +06:00
|
|
|
myIniOrientation = myVertRadioBtn->isChecked();
|
|
|
|
|
2005-07-25 12:50:07 +06:00
|
|
|
QString name = isHoriz ? "scalar_bar_horizontal_%1" : "scalar_bar_vertical_%1";
|
2005-06-07 19:22:20 +06:00
|
|
|
|
2009-02-17 10:27:49 +05:00
|
|
|
myIniX = mgr->doubleValue("SMESH", name.arg( "x" ),
|
|
|
|
myHorizRadioBtn->isChecked() ? DEF_HOR_X : DEF_VER_X);
|
2005-06-07 19:22:20 +06:00
|
|
|
|
2009-02-17 10:27:49 +05:00
|
|
|
myIniY = mgr->doubleValue("SMESH", name.arg( "y" ),
|
|
|
|
myHorizRadioBtn->isChecked() ? DEF_HOR_Y : DEF_VER_Y);
|
2005-06-07 19:22:20 +06:00
|
|
|
|
2009-02-17 10:27:49 +05:00
|
|
|
myIniW = mgr->doubleValue("SMESH", name.arg( "width" ),
|
|
|
|
myHorizRadioBtn->isChecked() ? DEF_HOR_W : DEF_VER_W);
|
|
|
|
|
|
|
|
myIniH = mgr->doubleValue("SMESH", name.arg( "height" ),
|
|
|
|
myHorizRadioBtn->isChecked() ? DEF_HOR_H : DEF_VER_H);
|
2004-06-18 14:34:31 +06:00
|
|
|
|
2005-06-07 19:22:20 +06:00
|
|
|
setOriginAndSize(myIniX, myIniY, myIniW, myIniH);
|
|
|
|
|
2009-02-17 10:27:49 +05:00
|
|
|
// --> then init from selection if necessary
|
|
|
|
onSelectionChanged();
|
2005-06-07 19:22:20 +06:00
|
|
|
|
2004-06-18 14:34:31 +06:00
|
|
|
/***************************************************************/
|
|
|
|
// Connect section
|
|
|
|
connect( myOkBtn, SIGNAL( clicked() ), this, SLOT( onOk() ) );
|
2009-02-17 10:27:49 +05:00
|
|
|
connect( myApplyBtn, SIGNAL( clicked() ), this, SLOT( onApply() ) );
|
2004-06-18 14:34:31 +06:00
|
|
|
connect( myCancelBtn, SIGNAL( clicked() ), this, SLOT( onCancel() ) );
|
2009-02-17 10:27:49 +05:00
|
|
|
connect( myHelpBtn, SIGNAL(clicked()), this, SLOT( onHelp() ) );
|
2004-06-18 14:34:31 +06:00
|
|
|
connect( myXSpin, SIGNAL( valueChanged( double ) ), this, SLOT( onXYChanged() ) );
|
|
|
|
connect( myYSpin, SIGNAL( valueChanged( double ) ), this, SLOT( onXYChanged() ) );
|
2009-02-17 10:27:49 +05:00
|
|
|
connect( aOrientationGrp, SIGNAL( buttonClicked( int ) ), this, SLOT( onOrientationChanged() ) );
|
|
|
|
connect( mySelectionMgr, SIGNAL( currentSelectionChanged() ), this, SLOT( onSelectionChanged() ) );
|
|
|
|
connect( mySMESHGUI, SIGNAL( SignalCloseAllDialogs() ), this, SLOT( onCancel() ) );
|
|
|
|
|
|
|
|
myHelpFileName = "about_quality_controls_page.html";
|
2003-05-19 20:07:00 +06:00
|
|
|
}
|
|
|
|
|
2004-06-18 14:34:31 +06:00
|
|
|
//=================================================================================================
|
|
|
|
/*!
|
|
|
|
* SMESHGUI_Preferences_ScalarBarDlg::~SMESHGUI_Preferences_ScalarBarDlg
|
|
|
|
*
|
|
|
|
* Destructor
|
2003-05-19 20:07:00 +06:00
|
|
|
*/
|
2004-06-18 14:34:31 +06:00
|
|
|
//=================================================================================================
|
2003-05-19 20:07:00 +06:00
|
|
|
SMESHGUI_Preferences_ScalarBarDlg::~SMESHGUI_Preferences_ScalarBarDlg()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2004-06-18 14:34:31 +06:00
|
|
|
//=================================================================================================
|
|
|
|
/*!
|
|
|
|
* SMESHGUI_Preferences_ScalarBarDlg::onOk
|
|
|
|
*
|
|
|
|
* OK button slot
|
|
|
|
*/
|
|
|
|
//=================================================================================================
|
|
|
|
void SMESHGUI_Preferences_ScalarBarDlg::onOk()
|
|
|
|
{
|
|
|
|
if ( onApply() )
|
|
|
|
onCancel();
|
|
|
|
}
|
|
|
|
|
|
|
|
//=================================================================================================
|
|
|
|
/*!
|
|
|
|
* SMESHGUI_Preferences_ScalarBarDlg::onApply
|
|
|
|
*
|
|
|
|
* Apply button slot
|
|
|
|
*/
|
|
|
|
//=================================================================================================
|
|
|
|
bool SMESHGUI_Preferences_ScalarBarDlg::onApply()
|
|
|
|
{
|
2009-02-17 10:27:49 +05:00
|
|
|
// Scalar Bar properties
|
|
|
|
if (!myActor)
|
|
|
|
return false;
|
|
|
|
vtkScalarBarActor* myScalarBarActor = myActor->GetScalarBarActor();
|
|
|
|
|
|
|
|
vtkTextProperty* aTitleTextPrp = myScalarBarActor->GetTitleTextProperty();
|
|
|
|
QColor aTColor = myTitleColorBtn->color();
|
|
|
|
aTitleTextPrp->SetColor( aTColor.red()/255., aTColor.green()/255., aTColor.blue()/255. );
|
|
|
|
if ( myTitleFontCombo->currentIndex() == 0 )
|
|
|
|
aTitleTextPrp->SetFontFamilyToArial();
|
|
|
|
else if ( myTitleFontCombo->currentIndex() == 1 )
|
|
|
|
aTitleTextPrp->SetFontFamilyToCourier();
|
|
|
|
else
|
|
|
|
aTitleTextPrp->SetFontFamilyToTimes();
|
|
|
|
aTitleTextPrp->SetBold( myTitleBoldCheck->isChecked() );
|
|
|
|
aTitleTextPrp->SetItalic( myTitleItalicCheck->isChecked() );
|
|
|
|
aTitleTextPrp->SetShadow( myTitleShadowCheck->isChecked() );
|
|
|
|
myScalarBarActor->SetTitleTextProperty( aTitleTextPrp );
|
|
|
|
|
|
|
|
vtkTextProperty* aLabelsTextPrp = myScalarBarActor->GetLabelTextProperty();
|
|
|
|
QColor aLColor = myLabelsColorBtn->color();
|
|
|
|
aLabelsTextPrp->SetColor( aLColor.red()/255., aLColor.green()/255., aLColor.blue()/255. );
|
|
|
|
if ( myLabelsFontCombo->currentIndex() == 0 )
|
|
|
|
aLabelsTextPrp->SetFontFamilyToArial();
|
|
|
|
else if ( myLabelsFontCombo->currentIndex() == 1 )
|
|
|
|
aLabelsTextPrp->SetFontFamilyToCourier();
|
|
|
|
else
|
|
|
|
aLabelsTextPrp->SetFontFamilyToTimes();
|
|
|
|
aLabelsTextPrp->SetBold( myLabelsBoldCheck->isChecked() );
|
|
|
|
aLabelsTextPrp->SetItalic( myLabelsItalicCheck->isChecked() );
|
|
|
|
aLabelsTextPrp->SetShadow( myLabelsShadowCheck->isChecked() );
|
|
|
|
myScalarBarActor->SetLabelTextProperty( aLabelsTextPrp );
|
|
|
|
|
|
|
|
myScalarBarActor->SetNumberOfLabels( myLabelsSpin->value() );
|
|
|
|
myScalarBarActor->SetMaximumNumberOfColors( myColorsSpin->value() );
|
|
|
|
|
|
|
|
if ( myHorizRadioBtn->isChecked() )
|
|
|
|
myScalarBarActor->SetOrientationToHorizontal();
|
|
|
|
else
|
|
|
|
myScalarBarActor->SetOrientationToVertical();
|
|
|
|
|
|
|
|
myScalarBarActor->SetPosition( myXSpin->value(), myYSpin->value() );
|
|
|
|
myScalarBarActor->SetWidth( myWidthSpin->value() );
|
|
|
|
myScalarBarActor->SetHeight( myHeightSpin->value() );
|
|
|
|
|
|
|
|
double aMin = myMinEdit->text().toDouble();
|
|
|
|
double aMax = myMaxEdit->text().toDouble();
|
|
|
|
vtkLookupTable* myLookupTable =
|
|
|
|
static_cast<vtkLookupTable*>(myScalarBarActor->GetLookupTable());
|
|
|
|
myLookupTable->SetRange( aMin, aMax );
|
|
|
|
myLookupTable->SetNumberOfTableValues(myColorsSpin->value());
|
|
|
|
myLookupTable->Build();
|
|
|
|
SMESH::RepaintCurrentView();
|
2004-06-18 14:34:31 +06:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
//=================================================================================================
|
|
|
|
/*!
|
|
|
|
* SMESHGUI_Preferences_ScalarBarDlg::onCancel
|
|
|
|
*
|
|
|
|
* Cancel button slot
|
|
|
|
*/
|
|
|
|
//=================================================================================================
|
|
|
|
void SMESHGUI_Preferences_ScalarBarDlg::onCancel()
|
|
|
|
{
|
|
|
|
close();
|
|
|
|
}
|
|
|
|
|
|
|
|
//=================================================================================================
|
|
|
|
/*!
|
2009-02-17 10:27:49 +05:00
|
|
|
* SMESHGUI_Preferences_ScalarBarDlg::onHelp
|
2004-06-18 14:34:31 +06:00
|
|
|
*
|
2009-02-17 10:27:49 +05:00
|
|
|
* Help button slot
|
2004-06-18 14:34:31 +06:00
|
|
|
*/
|
|
|
|
//=================================================================================================
|
2009-02-17 10:27:49 +05:00
|
|
|
void SMESHGUI_Preferences_ScalarBarDlg::onHelp()
|
2004-06-18 14:34:31 +06:00
|
|
|
{
|
2009-02-17 10:27:49 +05:00
|
|
|
LightApp_Application* app = (LightApp_Application*)(SUIT_Session::session()->activeApplication());
|
|
|
|
if (app)
|
|
|
|
app->onHelpContextModule(mySMESHGUI ? app->moduleName(mySMESHGUI->moduleName()) : QString(""), myHelpFileName);
|
|
|
|
else {
|
|
|
|
QString platform;
|
|
|
|
#ifdef WIN32
|
|
|
|
platform = "winapplication";
|
|
|
|
#else
|
|
|
|
platform = "application";
|
|
|
|
#endif
|
|
|
|
SUIT_MessageBox::warning(this, tr("WRN_WARNING"),
|
|
|
|
tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
|
|
|
|
arg(app->resourceMgr()->stringValue("ExternalBrowser",
|
|
|
|
platform)).
|
|
|
|
arg(myHelpFileName));
|
|
|
|
}
|
2004-06-18 14:34:31 +06:00
|
|
|
}
|
|
|
|
|
|
|
|
//=================================================================================================
|
|
|
|
/*!
|
|
|
|
* SMESHGUI_Preferences_ScalarBarDlg::onSelectionChanged
|
|
|
|
*
|
|
|
|
* Called when selection changed
|
|
|
|
*/
|
|
|
|
//=================================================================================================
|
|
|
|
void SMESHGUI_Preferences_ScalarBarDlg::onSelectionChanged()
|
|
|
|
{
|
2009-02-17 10:27:49 +05:00
|
|
|
SALOME_ListIO aList;
|
|
|
|
mySelectionMgr->selectedObjects(aList);
|
|
|
|
|
|
|
|
if (aList.Extent() == 1) {
|
|
|
|
Handle(SALOME_InteractiveObject) anIO = aList.First();
|
|
|
|
if( anIO->hasEntry() ) {
|
|
|
|
SMESH_Actor* anActor = SMESH::FindActorByEntry(anIO->getEntry());
|
|
|
|
if ( anActor && anActor->GetScalarBarActor() && anActor->GetControlMode() != SMESH_Actor::eNone ) {
|
|
|
|
myActor = anActor;
|
|
|
|
vtkScalarBarActor* myScalarBarActor = myActor->GetScalarBarActor();
|
|
|
|
|
|
|
|
if ( myScalarBarActor->GetLookupTable() ) {
|
|
|
|
vtkFloatingPointType *range = myScalarBarActor->GetLookupTable()->GetRange();
|
|
|
|
myMinEdit->setText( QString::number( range[0],'g',12 ) );
|
|
|
|
myMaxEdit->setText( QString::number( range[1],'g',12 ) );
|
2004-06-18 14:34:31 +06:00
|
|
|
}
|
2009-02-17 10:27:49 +05:00
|
|
|
|
|
|
|
vtkTextProperty* aTitleTextPrp = myScalarBarActor->GetTitleTextProperty();
|
|
|
|
vtkFloatingPointType aTColor[3];
|
|
|
|
aTitleTextPrp->GetColor( aTColor );
|
|
|
|
myTitleColorBtn->setColor( QColor( (int)( aTColor[0]*255 ), (int)( aTColor[1]*255 ), (int)( aTColor[2]*255 ) ) );
|
|
|
|
myTitleFontCombo->setCurrentIndex( aTitleTextPrp->GetFontFamily() );
|
|
|
|
myTitleBoldCheck->setChecked( aTitleTextPrp->GetBold() );
|
|
|
|
myTitleItalicCheck->setChecked( aTitleTextPrp->GetItalic() );
|
|
|
|
myTitleShadowCheck->setChecked( aTitleTextPrp->GetShadow() );
|
|
|
|
|
|
|
|
vtkTextProperty* aLabelsTextPrp = myScalarBarActor->GetLabelTextProperty();
|
|
|
|
vtkFloatingPointType aLColor[3];
|
|
|
|
aLabelsTextPrp->GetColor( aLColor );
|
|
|
|
myLabelsColorBtn->setColor( QColor( (int)( aLColor[0]*255 ), (int)( aLColor[1]*255 ), (int)( aLColor[2]*255 ) ) );
|
|
|
|
myLabelsFontCombo->setCurrentIndex( aLabelsTextPrp->GetFontFamily() );
|
|
|
|
myLabelsBoldCheck->setChecked( aLabelsTextPrp->GetBold() );
|
|
|
|
myLabelsItalicCheck->setChecked( aLabelsTextPrp->GetItalic() );
|
|
|
|
myLabelsShadowCheck->setChecked( aLabelsTextPrp->GetShadow() );
|
|
|
|
|
|
|
|
myLabelsSpin->setValue( myScalarBarActor->GetNumberOfLabels() );
|
|
|
|
myColorsSpin->setValue( myScalarBarActor->GetMaximumNumberOfColors() );
|
|
|
|
|
|
|
|
if ( myScalarBarActor->GetOrientation() == VTK_ORIENT_VERTICAL )
|
|
|
|
myVertRadioBtn->setChecked( true );
|
|
|
|
else
|
|
|
|
myHorizRadioBtn->setChecked( true );
|
|
|
|
myIniOrientation = myVertRadioBtn->isChecked();
|
|
|
|
|
|
|
|
myIniX = myScalarBarActor->GetPosition()[0];
|
|
|
|
myIniY = myScalarBarActor->GetPosition()[1];
|
|
|
|
myIniW = myScalarBarActor->GetWidth();
|
|
|
|
myIniH = myScalarBarActor->GetHeight();
|
|
|
|
setOriginAndSize( myIniX, myIniY, myIniW, myIniH );
|
|
|
|
|
|
|
|
myRangeGrp->setEnabled( true );
|
|
|
|
myFontGrp->setEnabled( true );
|
|
|
|
myLabColorGrp->setEnabled( true );
|
|
|
|
myOrientationGrp->setEnabled( true );
|
|
|
|
myOriginDimGrp->setEnabled( true );
|
|
|
|
myOkBtn->setEnabled( true );
|
|
|
|
myApplyBtn->setEnabled( true );
|
|
|
|
return;
|
2004-06-18 14:34:31 +06:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2009-02-17 10:27:49 +05:00
|
|
|
myActor = 0;
|
|
|
|
myRangeGrp->setEnabled( false );
|
|
|
|
myFontGrp->setEnabled( false );
|
|
|
|
myLabColorGrp->setEnabled( false );
|
|
|
|
myOrientationGrp->setEnabled( false );
|
|
|
|
myOriginDimGrp->setEnabled( false );
|
|
|
|
myOkBtn->setEnabled( false );
|
|
|
|
myApplyBtn->setEnabled( false );
|
2004-06-18 14:34:31 +06:00
|
|
|
}
|
|
|
|
|
|
|
|
//=================================================================================================
|
|
|
|
/*!
|
|
|
|
* SMESHGUI_Preferences_ScalarBarDlg::closeEvent
|
|
|
|
*
|
|
|
|
* Close event handler
|
|
|
|
*/
|
|
|
|
//=================================================================================================
|
|
|
|
void SMESHGUI_Preferences_ScalarBarDlg::closeEvent( QCloseEvent* e )
|
|
|
|
{
|
2009-02-17 10:27:49 +05:00
|
|
|
myDlg = 0;
|
2004-06-18 14:34:31 +06:00
|
|
|
QDialog::closeEvent( e );
|
|
|
|
}
|
|
|
|
|
|
|
|
//=================================================================================================
|
|
|
|
/*!
|
|
|
|
* SMESHGUI_Preferences_ScalarBarDlg::onXYChanged
|
|
|
|
*
|
|
|
|
* Called when X, Y values are changed
|
|
|
|
*/
|
|
|
|
//=================================================================================================
|
|
|
|
void SMESHGUI_Preferences_ScalarBarDlg::onXYChanged()
|
|
|
|
{
|
2009-02-17 10:27:49 +05:00
|
|
|
myWidthSpin->setMaximum( 1.0 - myXSpin->value() );
|
|
|
|
myHeightSpin->setMaximum( 1.0 - myYSpin->value() );
|
2004-06-18 14:34:31 +06:00
|
|
|
}
|
|
|
|
|
|
|
|
//=================================================================================================
|
|
|
|
/*!
|
|
|
|
* SMESHGUI_Preferences_ScalarBarDlg::setOriginAndSize
|
|
|
|
*
|
|
|
|
* Called when X, Y values are changed
|
|
|
|
*/
|
|
|
|
//=================================================================================================
|
|
|
|
void SMESHGUI_Preferences_ScalarBarDlg::setOriginAndSize( const double x,
|
|
|
|
const double y,
|
|
|
|
const double w,
|
|
|
|
const double h )
|
|
|
|
{
|
|
|
|
blockSignals( true );
|
|
|
|
myXSpin->setValue( x );
|
|
|
|
myYSpin->setValue( y );
|
2009-02-17 10:27:49 +05:00
|
|
|
myWidthSpin->setMaximum( 1.0 );
|
2004-06-18 14:34:31 +06:00
|
|
|
myWidthSpin->setValue( w );
|
2009-02-17 10:27:49 +05:00
|
|
|
myHeightSpin->setMaximum( 1.0 );
|
2004-06-18 14:34:31 +06:00
|
|
|
myHeightSpin->setValue( h );
|
|
|
|
blockSignals( false );
|
|
|
|
onXYChanged();
|
|
|
|
}
|
|
|
|
|
|
|
|
//=================================================================================================
|
|
|
|
/*!
|
|
|
|
* SMESHGUI_Preferences_ScalarBarDlg::onOrientationChanged
|
|
|
|
*
|
|
|
|
* Called when orientation is changed
|
|
|
|
*/
|
|
|
|
//=================================================================================================
|
2005-06-07 19:22:20 +06:00
|
|
|
void SMESHGUI_Preferences_ScalarBarDlg::onOrientationChanged()
|
2004-06-18 14:34:31 +06:00
|
|
|
{
|
2009-02-17 10:27:49 +05:00
|
|
|
initScalarBarFromResources();
|
2006-03-13 20:29:49 +05:00
|
|
|
|
2004-06-18 14:34:31 +06:00
|
|
|
int aOrientation = myVertRadioBtn->isChecked();
|
|
|
|
if ( aOrientation == myIniOrientation )
|
|
|
|
setOriginAndSize( myIniX, myIniY, myIniW, myIniH );
|
|
|
|
else
|
2005-06-07 19:22:20 +06:00
|
|
|
setOriginAndSize( aOrientation ? DEF_VER_X : DEF_HOR_X,
|
|
|
|
aOrientation ? DEF_VER_Y : DEF_HOR_Y,
|
|
|
|
aOrientation ? DEF_VER_W : DEF_HOR_W,
|
2004-06-18 14:34:31 +06:00
|
|
|
aOrientation ? DEF_VER_H : DEF_HOR_H );
|
|
|
|
}
|
2006-03-13 20:29:49 +05:00
|
|
|
|
|
|
|
//=================================================================================================
|
|
|
|
/*!
|
|
|
|
* 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" ));
|
|
|
|
}
|
|
|
|
}
|