Salome HOME
updated copyright message
[modules/gui.git] / src / SVTK / SVTK_UpdateRateDlg.cxx
index 15a8d0a24099f3a06040f7ecae4bede198cc30bb..d3c316228249f6ce34dd91d624ae78add1ab46a4 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007-2015  CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2023  CEA, EDF, OPEN CASCADE
 //
 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
@@ -49,7 +49,7 @@
 #include <vtkMapper.h>
 #include <vtkDataSet.h>
 
-static double OFF_UPDATE_RATE = 0.00001;
+static double OFF_UPDATE_RATE = 0.0001;
 static double FLOAT_TOLERANCE = 1.0 / VTK_FLOAT_MAX;
 
 namespace
@@ -168,10 +168,10 @@ SVTK_UpdateRateDlg
   ViewerTools_DialogBase(theAction,
                          theParent, 
                          theName),
-  myPriority(0.0),
-  myEventCallbackCommand(vtkCallbackCommand::New()),
   myRWInteractor(theParent->GetInteractor()),
-  myAction(theAction)
+  myAction(theAction),
+  myPriority(0.0),
+  myEventCallbackCommand(vtkCallbackCommand::New())
 {
   vtkRenderWindowInteractor* aRWI = myRWInteractor->GetDevice();
   bool anIsEnabledUpdateRate = false;
@@ -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();
 }
 
 /*!