X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FSVTK%2FSVTK_UpdateRateDlg.cxx;h=67b8e3a7f4c5b04bfe9ffce85408dd5b9656d702;hb=4444aae1f5322eae93be1257dcad646596a4b032;hp=7023a0e265407cd5b73d7ea6b4d6e503b3f95940;hpb=6878ef4d7381638ec39d1ca9d03afc21a69401aa;p=modules%2Fgui.git diff --git a/src/SVTK/SVTK_UpdateRateDlg.cxx b/src/SVTK/SVTK_UpdateRateDlg.cxx index 7023a0e26..67b8e3a7f 100644 --- a/src/SVTK/SVTK_UpdateRateDlg.cxx +++ b/src/SVTK/SVTK_UpdateRateDlg.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2016 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 @@ -49,8 +49,8 @@ #include #include -static double OFF_UPDATE_RATE = 0.00001; -static double FLOAT_TOLERANCE = 1.0 / VTK_LARGE_FLOAT; +static double OFF_UPDATE_RATE = 0.0001; +static double FLOAT_TOLERANCE = 1.0 / VTK_FLOAT_MAX; namespace { @@ -195,7 +195,7 @@ SVTK_UpdateRateDlg aLabel->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed); aGridLayout->addWidget(aLabel, 0, 0); - QtxDoubleSpinBox* aDblSpinBox = new QtxDoubleSpinBox(OFF_UPDATE_RATE, VTK_LARGE_FLOAT, 2, aGroupBox); + QtxDoubleSpinBox* aDblSpinBox = new QtxDoubleSpinBox(OFF_UPDATE_RATE, VTK_FLOAT_MAX, 2, aGroupBox); aDblSpinBox->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); aGridLayout->addWidget(aDblSpinBox, 0, 1); @@ -209,7 +209,7 @@ SVTK_UpdateRateDlg aLabel->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed); aGridLayout->addWidget(aLabel, 1, 0); - QtxDoubleSpinBox* aDblSpinBox = new QtxDoubleSpinBox(OFF_UPDATE_RATE, VTK_LARGE_FLOAT, 2, aGroupBox); + QtxDoubleSpinBox* aDblSpinBox = new QtxDoubleSpinBox(OFF_UPDATE_RATE, VTK_FLOAT_MAX, 2, aGroupBox); aDblSpinBox->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); aGridLayout->addWidget(aDblSpinBox, 1, 1); @@ -232,7 +232,7 @@ SVTK_UpdateRateDlg aGridLayout->addWidget(aLabel, 0, 0); QLineEdit* aLineEdit = new QLineEdit( aGroupBox ); - aLineEdit->setReadOnly( TRUE ); + aLineEdit->setReadOnly( true ); aGridLayout->addWidget(aLineEdit, 0, 1); myCurrentUpdateRateLineEdit = aLineEdit; @@ -244,7 +244,7 @@ SVTK_UpdateRateDlg aGridLayout->addWidget(aLabel, 1, 0); QLineEdit* aLineEdit = new QLineEdit( aGroupBox ); - aLineEdit->setReadOnly( TRUE ); + aLineEdit->setReadOnly( true ); aGridLayout->addWidget(aLineEdit, 1, 1); myNumberOfCellsLineEdit = aLineEdit; @@ -259,23 +259,23 @@ SVTK_UpdateRateDlg aHBoxLayout->setSpacing(6); { QPushButton* aPushButton = new QPushButton(tr("OK"), aGroupBox); - aPushButton->setDefault(TRUE); - aPushButton->setAutoDefault(TRUE); + aPushButton->setDefault(true); + aPushButton->setAutoDefault(true); aHBoxLayout->addWidget(aPushButton); connect(aPushButton, SIGNAL(clicked()), this, SLOT(onClickOk())); } { QPushButton* aPushButton = new QPushButton(tr("Apply"), aGroupBox); - aPushButton->setDefault(TRUE); - aPushButton->setAutoDefault(TRUE); + aPushButton->setDefault(true); + aPushButton->setAutoDefault(true); aHBoxLayout->addWidget(aPushButton); connect(aPushButton, SIGNAL(clicked()), this, SLOT(onClickApply())); } aHBoxLayout->addStretch(); { QPushButton* aPushButton = new QPushButton(tr("Close"), aGroupBox); - aPushButton->setDefault(TRUE); - aPushButton->setAutoDefault(TRUE); + aPushButton->setDefault(true); + aPushButton->setAutoDefault(true); aHBoxLayout->addWidget(aPushButton); connect(aPushButton, SIGNAL(clicked()), this, SLOT(onClickClose())); } @@ -332,18 +332,13 @@ SVTK_UpdateRateDlg { vtkRenderWindowInteractor* aRWI = myRWInteractor->GetDevice(); - double anUpdateRate; - if(myIsEnableUpdateRateGroupBox->isChecked()){ - anUpdateRate = AdjustUpdateRate(myRWInteractor,myDesiredUpdateRateSblSpinBox->value()); - aRWI->SetDesiredUpdateRate(anUpdateRate); - anUpdateRate = AdjustUpdateRate(myRWInteractor,myStillUpdateRateSblSpinBox->value()); - aRWI->SetStillUpdateRate(anUpdateRate); - }else{ - aRWI->SetDesiredUpdateRate(OFF_UPDATE_RATE); - aRWI->SetStillUpdateRate(OFF_UPDATE_RATE); - } + double aDesirableUpdateRate = aRWI->GetDesiredUpdateRate(); + double aStillUpdateRate = aRWI->GetStillUpdateRate(); + bool isUpdateRate = (aDesirableUpdateRate != OFF_UPDATE_RATE) || (aStillUpdateRate != OFF_UPDATE_RATE); - myRWInteractor->getRenderWindow()->Render(); + myIsEnableUpdateRateGroupBox->setChecked(isUpdateRate); + myDesiredUpdateRateSblSpinBox->setValue(aDesirableUpdateRate); + myStillUpdateRateSblSpinBox->setValue(aStillUpdateRate); } /*! @@ -353,7 +348,7 @@ void SVTK_UpdateRateDlg ::onClickOk() { - Update(); + onClickApply(); onClickClose(); } @@ -364,7 +359,20 @@ void SVTK_UpdateRateDlg ::onClickApply() { - Update(); + vtkRenderWindowInteractor* aRWI = myRWInteractor->GetDevice(); + double anUpdateRate; + if (myIsEnableUpdateRateGroupBox->isChecked()) { + anUpdateRate = AdjustUpdateRate(myRWInteractor,myDesiredUpdateRateSblSpinBox->value()); + aRWI->SetDesiredUpdateRate(anUpdateRate); + anUpdateRate = AdjustUpdateRate(myRWInteractor,myStillUpdateRateSblSpinBox->value()); + aRWI->SetStillUpdateRate(anUpdateRate); + } + else { + aRWI->SetDesiredUpdateRate(OFF_UPDATE_RATE); + aRWI->SetStillUpdateRate(OFF_UPDATE_RATE); + } + + myRWInteractor->getRenderWindow()->Render(); } /*!