]> SALOME platform Git repositories - modules/visu.git/commitdiff
Salome HOME
Fix for Bug IPAL16749 mergeto_BR_Dev_For_4_0_29Oct07
authorapo <apo@opencascade.com>
Fri, 26 Oct 2007 14:51:32 +0000 (14:51 +0000)
committerapo <apo@opencascade.com>
Fri, 26 Oct 2007 14:51:32 +0000 (14:51 +0000)
  MULTIPR: ?use imposed range? radio button is not saved for a new time stamp

src/VISUGUI/VisuGUI_GaussPointsDlg.cxx
src/VISUGUI/VisuGUI_GaussPointsDlg.h
src/VISU_I/VISU_GaussPoints_i.cc

index 5e0b3fc13c86aa9e276650061883ee55e11bbe66..2e5c63630353c8c155b4b90041807ea5fb74d88b 100644 (file)
@@ -303,32 +303,51 @@ VisuGUI_GaussScalarBarPane::VisuGUI_GaussScalarBarPane (QWidget * parent):
   myIsStoreTextProp = false;
 }
 
+bool VisuGUI_GaussScalarBarPane::UseFieldRange(bool theInit)
+{
+  if ( theInit )
+    return !myPrsCopy->IsRangeFixed();
+
+  return RBFieldRange->isChecked() || !myPrsCopy->GetIsActiveLocalScalarBar();
+}
+
+
 void VisuGUI_GaussScalarBarPane::onGlobalScalarBar()
 {
-  myCBDisplayed->setChecked( true );
+  myPrsCopy->SetIsActiveLocalScalarBar(false);
+  myPrsCopy->SetSourceRange();
+
+  myCBDisplayed->setEnabled( false );
 
   RBImposedRange->setEnabled( false );
   RBFieldRange->setEnabled( false );
+
   MinEdit->setEnabled( false );
   MaxEdit->setEnabled( false );
 
-  myPrsCopy->SetIsActiveLocalScalarBar(false);
+  MinEdit->setText( QString::number( myPrsCopy->GetMin() ) );
+  MaxEdit->setText( QString::number( myPrsCopy->GetMax() ) );
 }
 
 
 void VisuGUI_GaussScalarBarPane::onLocalScalarBar()
 {
+  myPrsCopy->SetIsActiveLocalScalarBar(true);
+  if ( RBFieldRange->isChecked() )
+    myPrsCopy->SetSourceRange();
+  else
+    myPrsCopy->SetRange(myPrsCopy->GetMin(), myPrsCopy->GetMax());
+
   myCBDisplayed->setEnabled( true );
 
   RBImposedRange->setEnabled( true );
   RBFieldRange->setEnabled( true );
 
-  if ( RBImposedRange->isChecked() ) {
-    MinEdit->setEnabled( true );
-    MaxEdit->setEnabled( true );
-  }
+  MinEdit->setEnabled( RBImposedRange->isChecked() );
+  MaxEdit->setEnabled( RBImposedRange->isChecked() );
 
-  myPrsCopy->SetIsActiveLocalScalarBar(true);
+  MinEdit->setText( QString::number( myPrsCopy->GetMin() ) );
+  MaxEdit->setText( QString::number( myPrsCopy->GetMax() ) );
 }
 
 
@@ -337,14 +356,16 @@ void VisuGUI_GaussScalarBarPane::onLocalScalarBar()
 */
 void VisuGUI_GaussScalarBarPane::fieldRangeClicked()
 {
+  myPrsCopy->SetSourceRange();
+
+  RBFieldRange->setChecked( true );
   RBImposedRange->setChecked( false );
+
   MinEdit->setEnabled( false );
   MaxEdit->setEnabled( false );
 
-  MinEdit->setText( QString::number( myPrsCopy->GetSourceMin() ) );
-  MaxEdit->setText( QString::number( myPrsCopy->GetSourceMax() ) );
-
-  myPrsCopy->SetSourceRange();
+  MinEdit->setText( QString::number( myPrsCopy->GetMin() ) );
+  MaxEdit->setText( QString::number( myPrsCopy->GetMax() ) );
 }
 
 
@@ -353,11 +374,13 @@ void VisuGUI_GaussScalarBarPane::fieldRangeClicked()
 */
 void VisuGUI_GaussScalarBarPane::imposedRangeClicked()
 {
+  myPrsCopy->SetRange(MinEdit->text().toDouble(), MaxEdit->text().toDouble());
+
+  RBImposedRange->setChecked( true );
   RBFieldRange->setChecked( false );
+
   MinEdit->setEnabled( true );
   MaxEdit->setEnabled( true );
-
-  myPrsCopy->SetRange(MinEdit->text().toDouble(), MaxEdit->text().toDouble());
 }
 
 
@@ -367,34 +390,28 @@ void VisuGUI_GaussScalarBarPane::imposedRangeClicked()
 void VisuGUI_GaussScalarBarPane::changeScalarMode( int theMode )
 {
   myPrsCopy->SetScalarMode( theMode );
-  if ( RBFieldRange->isChecked() ) {
-    CORBA::Double aRange[2] = {myPrsCopy->GetSourceMin(), myPrsCopy->GetSourceMax()};
-    MinEdit->setText( QString::number( aRange[0] ) );
-    MaxEdit->setText( QString::number( aRange[1] ) );
+  if ( UseFieldRange() ) {
+    MinEdit->setText( QString::number( myPrsCopy->GetSourceMin() ) );
+    MaxEdit->setText( QString::number( myPrsCopy->GetSourceMax() ) );
   }
 }
 
 /**
  * Initialise dialog box from presentation object
  */
-void VisuGUI_GaussScalarBarPane::initFromPrsObject(VISU::GaussPoints_i* thePrs) {
+void VisuGUI_GaussScalarBarPane::initFromPrsObject(VISU::GaussPoints_i* thePrs,
+                                                  bool theInit ) 
+{
   myPrsCopy = thePrs;
 
   myModeCombo->setCurrentItem(thePrs->GetScalarMode());
 
   bool activeLocal = thePrs->GetIsActiveLocalScalarBar();
   if ( activeLocal ) {
-    if ( thePrs->IsRangeFixed() ) {
-      RBImposedRange->setChecked( true );
-      RBFieldRange->setChecked( false );
-      MinEdit->setEnabled( true );
-      MaxEdit->setEnabled( true );
-    } else {
-      RBImposedRange->setChecked( false );
-      RBFieldRange->setChecked( true );
-      MinEdit->setEnabled( false );
-      MaxEdit->setEnabled( false );
-    }
+    RBImposedRange->setChecked( !UseFieldRange(theInit) );
+    RBFieldRange->setChecked( UseFieldRange(theInit) );
+    MinEdit->setEnabled( !UseFieldRange(theInit) );
+    MaxEdit->setEnabled( !UseFieldRange(theInit) );
   } else {
     RBImposedRange->setEnabled( false );
     RBFieldRange->setEnabled( false );
@@ -402,13 +419,8 @@ void VisuGUI_GaussScalarBarPane::initFromPrsObject(VISU::GaussPoints_i* thePrs)
     MaxEdit->setEnabled( false );
   }
 
-  if ( RBFieldRange->isChecked() ) {
-    MinEdit->setText( QString::number( thePrs->GetSourceMin() ) );
-    MaxEdit->setText( QString::number( thePrs->GetSourceMax() ) );
-  } else {
-    MinEdit->setText( QString::number( thePrs->GetMin() ) );
-    MaxEdit->setText( QString::number( thePrs->GetMax() ) );
-  }
+  MinEdit->setText( QString::number( thePrs->GetMin() ) );
+  MaxEdit->setText( QString::number( thePrs->GetMax() ) );
 
   setPosAndSize( thePrs->GetPosX(),
                 thePrs->GetPosY(),
@@ -780,7 +792,7 @@ void VisuGUI_GaussPointsDlg::initFromPrsObject( VISU::ColoredPrs3d_i* thePrs,
   if( theInit )
     myPrsCopy = VISU::TSameAsFactory<VISU::TGAUSSPOINTS>().Create(thePrs, VISU::ColoredPrs3d_i::EDoNotPublish);
 
-  myScalarPane->initFromPrsObject( myPrsCopy );
+  myScalarPane->initFromPrsObject( myPrsCopy, theInit );
 
   bool isDeformed = myPrsCopy->GetIsDeformed();
   myScaleSpinBox->setValue( myPrsCopy->GetScaleFactor() );
index 7bd912df13da504600208f946cdd4a425962ec15..d66df5fcbc6e4580f0f114bbf0214ad190d10aef 100644 (file)
@@ -62,7 +62,7 @@ class VisuGUI_GaussScalarBarPane : public QVBox
   int     getNbColors();
   int     getNbLabels();
 
-  void    initFromPrsObject(VISU::GaussPoints_i* thePrs);
+  void    initFromPrsObject(VISU::GaussPoints_i* thePrs, bool theInit);
   int     storeToPrsObject(VISU::GaussPoints_i* thePrs);
 
  protected:
@@ -104,6 +104,8 @@ class VisuGUI_GaussScalarBarPane : public QVBox
   int             myRangeMode;
   bool myIsStoreTextProp;
 
+  bool UseFieldRange( bool theInit = true );
+
  private slots:
   void onGlobalScalarBar();
   void onLocalScalarBar();
index 47ddbf40e9b3b9b4be4c5144a714a5b1cb8f887c..48331e5dacff4ff9ee2d02905aae97bb985a4ed8 100644 (file)
@@ -1033,15 +1033,10 @@ VISU::GaussPoints_i
 {
   VISU::TSetModified aModified(this);
 
-  if(IsTimeStampFixed() || GetIsActiveLocalScalarBar())
-    ProcessVoidEvent(new TVoidMemFunEvent<VISU_ColoredPL>
-                    (GetSpecificPL(), &VISU_ColoredPL::SetSourceRange));
-  else{
-    TMinMax aTMinMax = GetField()->GetMinMax(GetScalarMode());
-    vtkFloatingPointType aScalarRange[2] = {aTMinMax.first, aTMinMax.second};
-    ProcessVoidEvent(new TVoidMemFun1ArgEvent<VISU_ColoredPL, vtkFloatingPointType*>
-                    (GetSpecificPL(), &VISU_ColoredPL::SetScalarRange, aScalarRange));
-  }
+  vtkFloatingPointType aScalarRange[2] = {GetSourceMin(), GetSourceMax()};
+  ProcessVoidEvent(new TVoidMemFun1ArgEvent<VISU_ColoredPL, vtkFloatingPointType*>
+                  (GetSpecificPL(), &VISU_ColoredPL::SetScalarRange, aScalarRange));
+
   UseFixedRange(false);
 }