From: apo Date: Fri, 26 Oct 2007 14:51:32 +0000 (+0000) Subject: Fix for Bug IPAL16749 X-Git-Tag: mergeto_BR_Dev_For_4_0_29Oct07 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=d8d305915899a29c1e7d3568fd89f2263086cd34;p=modules%2Fvisu.git Fix for Bug IPAL16749 MULTIPR: ?use imposed range? radio button is not saved for a new time stamp --- diff --git a/src/VISUGUI/VisuGUI_GaussPointsDlg.cxx b/src/VISUGUI/VisuGUI_GaussPointsDlg.cxx index 5e0b3fc1..2e5c6363 100644 --- a/src/VISUGUI/VisuGUI_GaussPointsDlg.cxx +++ b/src/VISUGUI/VisuGUI_GaussPointsDlg.cxx @@ -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().Create(thePrs, VISU::ColoredPrs3d_i::EDoNotPublish); - myScalarPane->initFromPrsObject( myPrsCopy ); + myScalarPane->initFromPrsObject( myPrsCopy, theInit ); bool isDeformed = myPrsCopy->GetIsDeformed(); myScaleSpinBox->setValue( myPrsCopy->GetScaleFactor() ); diff --git a/src/VISUGUI/VisuGUI_GaussPointsDlg.h b/src/VISUGUI/VisuGUI_GaussPointsDlg.h index 7bd912df..d66df5fc 100644 --- a/src/VISUGUI/VisuGUI_GaussPointsDlg.h +++ b/src/VISUGUI/VisuGUI_GaussPointsDlg.h @@ -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(); diff --git a/src/VISU_I/VISU_GaussPoints_i.cc b/src/VISU_I/VISU_GaussPoints_i.cc index 47ddbf40..48331e5d 100644 --- a/src/VISU_I/VISU_GaussPoints_i.cc +++ b/src/VISU_I/VISU_GaussPoints_i.cc @@ -1033,15 +1033,10 @@ VISU::GaussPoints_i { VISU::TSetModified aModified(this); - if(IsTimeStampFixed() || GetIsActiveLocalScalarBar()) - ProcessVoidEvent(new TVoidMemFunEvent - (GetSpecificPL(), &VISU_ColoredPL::SetSourceRange)); - else{ - TMinMax aTMinMax = GetField()->GetMinMax(GetScalarMode()); - vtkFloatingPointType aScalarRange[2] = {aTMinMax.first, aTMinMax.second}; - ProcessVoidEvent(new TVoidMemFun1ArgEvent - (GetSpecificPL(), &VISU_ColoredPL::SetScalarRange, aScalarRange)); - } + vtkFloatingPointType aScalarRange[2] = {GetSourceMin(), GetSourceMax()}; + ProcessVoidEvent(new TVoidMemFun1ArgEvent + (GetSpecificPL(), &VISU_ColoredPL::SetScalarRange, aScalarRange)); + UseFixedRange(false); }