]> SALOME platform Git repositories - modules/visu.git/commitdiff
Salome HOME
Fix for Bug NPAL16764 - EDF 553 VISU :
authorapo <apo@opencascade.com>
Wed, 19 Sep 2007 08:19:55 +0000 (08:19 +0000)
committerapo <apo@opencascade.com>
Wed, 19 Sep 2007 08:19:55 +0000 (08:19 +0000)
In Animation Bad range by default in Scalarmap
The bug is fixed by introduction a special TMinMaxController interface which can be applied to a VISU colored 3D presentations.

40 files changed:
idl/VISU_Gen.idl
src/GUITOOLS/VisuGUITools.h
src/VISUGUI/VisuGUI.cxx
src/VISUGUI/VisuGUI.h
src/VISUGUI/VisuGUI_BuildProgressDlg.cxx
src/VISUGUI/VisuGUI_BuildProgressDlg.h
src/VISUGUI/VisuGUI_CutLinesDlg.cxx
src/VISUGUI/VisuGUI_CutLinesDlg.h
src/VISUGUI/VisuGUI_CutPlanesDlg.cxx
src/VISUGUI/VisuGUI_CutPlanesDlg.h
src/VISUGUI/VisuGUI_DeformedShapeDlg.cxx
src/VISUGUI/VisuGUI_DeformedShapeDlg.h
src/VISUGUI/VisuGUI_GaussPointsDlg.cxx
src/VISUGUI/VisuGUI_GaussPointsDlg.h
src/VISUGUI/VisuGUI_IsoSurfacesDlg.cxx
src/VISUGUI/VisuGUI_IsoSurfacesDlg.h
src/VISUGUI/VisuGUI_Plot3DDlg.cxx
src/VISUGUI/VisuGUI_Plot3DDlg.h
src/VISUGUI/VisuGUI_Prs3dDlg.cxx
src/VISUGUI/VisuGUI_Prs3dDlg.h
src/VISUGUI/VisuGUI_Prs3dTools.h
src/VISUGUI/VisuGUI_ScalarBarDlg.cxx
src/VISUGUI/VisuGUI_ScalarBarDlg.h
src/VISUGUI/VisuGUI_ScalarMapOnDeformedShapeDlg.cxx
src/VISUGUI/VisuGUI_ScalarMapOnDeformedShapeDlg.h
src/VISUGUI/VisuGUI_StreamLinesDlg.cxx
src/VISUGUI/VisuGUI_StreamLinesDlg.h
src/VISUGUI/VisuGUI_TimeAnimation.cxx
src/VISUGUI/VisuGUI_TimeAnimation.h
src/VISUGUI/VisuGUI_VectorsDlg.cxx
src/VISUGUI/VisuGUI_VectorsDlg.h
src/VISUGUI/VisuGUI_ViewTools.h
src/VISU_I/SALOME_GenericObjPointer.hh
src/VISU_I/VISU_ColoredPrs3dCache_i.cc
src/VISU_I/VISU_ColoredPrs3d_i.cc
src/VISU_I/VISU_ColoredPrs3d_i.hh
src/VISU_I/VISU_ScalarMapOnDeformedShape_i.cc
src/VISU_I/VISU_ScalarMapOnDeformedShape_i.hh
src/VISU_I/VISU_TimeAnimation.cxx
src/VISU_I/VISU_TimeAnimation.h

index f092a2a76b72d1e7748d98ac53f9af5cd661dd5c..e533280ff73ac8ebb9b5310e19d0f33acc89e4d2 100644 (file)
@@ -1485,7 +1485,7 @@ module VISU {
    * This enumeration contains a set of available animation modes.
    */
     enum AnimationMode{ PARALLEL, /*!< parallel mode of animation. */
-                       SUCCCESSIVE /*!< succcessive mode of animation. */
+                       SUCCESSIVE /*!< succcessive mode of animation. */
     };
     
     /*! Defines the field which will be used as a base for generation of the animation.
index d8fbf8a649a67f6e8580222a5ea2e01fc440d62b..30159eb267e16ef6fce4d0244dc9d99613e5f1b2 100755 (executable)
@@ -44,4 +44,4 @@
  #define VISU_GUITOOLS_EXPORT
 #endif
 
-#endif
\ No newline at end of file
+#endif
index 905cc462e33512c4a8cc40bca05e75f3ad4f2a2f..5f8e979445e0ff587c710b34ec670b94e454623c 100644 (file)
@@ -1714,7 +1714,7 @@ VisuGUI
 //----------------------------------------------------------------------------
 void
 VisuGUI
-::OnTimeAnimation(int theMode)
+::OnTimeAnimation(VISU::Animation::AnimationMode theMode)
 {
   if (!VISU::GetActiveViewWindow<SVTK_ViewWindow>(this))
     return;
@@ -1747,14 +1747,14 @@ void
 VisuGUI::
 OnParallelTimeAnimation()
 {
-  OnTimeAnimation(0);
+  OnTimeAnimation(VISU::Animation::PARALLEL);
 }
 
 void
 VisuGUI::
 OnSucccessiveTimeAnimation()
 {
-  OnTimeAnimation(1);
+  OnTimeAnimation(VISU::Animation::SUCCESSIVE);
 }
 
 //----------------------------------------------------------------------------
@@ -2986,7 +2986,6 @@ void VisuGUI::createPreferences()
   addPreference( tr( "Full MED loading" ), importGr, LightApp_Preferences::Bool, "VISU", "full_med_loading" );
   addPreference( tr( "Build at once" ), importGr, LightApp_Preferences::Bool, "VISU", "build_at_once" );
   addPreference( tr( "Build fields" ), importGr, LightApp_Preferences::Bool, "VISU", "build_fields" );
-  addPreference( tr( "Build min/max" ), importGr, LightApp_Preferences::Bool, "VISU", "build_min_max" );
   addPreference( tr( "Build groups" ), importGr, LightApp_Preferences::Bool, "VISU", "build_groups" );
   addPreference( tr( "Close dialog at finish" ), importGr, LightApp_Preferences::Bool, "VISU", "close_at_finish" );
 
@@ -3474,7 +3473,7 @@ void VisuGUI::OnPlot3dFromCutPlane()
        int aValue = aResourceMgr->integerValue("VISU","BuildDefaultPrs3d",0);
        if (!aValue) {
          VisuGUI_Plot3DDlg* aDlg = new VisuGUI_Plot3DDlg(this);
-         aDlg->initFromPrsObject(aPrs3d);
+         aDlg->initFromPrsObject(aPrs3d, true);
          int    aOrient = aCutPrs->GetOrientationType(); // Plot3d has the same orientation type
          double aRotX = aCutPrs->GetRotateX();
          double aRotY = aCutPrs->GetRotateY();
index c672c5d806d96f5f4ee1d0dc34e126320a54f5dc..8cc477c99827d516fdc70f0a946bb3c4d73dd3a6 100644 (file)
@@ -177,7 +177,7 @@ protected slots:
 protected:
   virtual LightApp_Selection* createSelection() const;
 
-  void OnTimeAnimation(int theMode);
+  void OnTimeAnimation(VISU::Animation::AnimationMode theMode);
 
 private:
   void createActions();
index e1dace81abd4b1f2f8a1956f3fe1d8097a0dee97..0c40d8e2daa6c8ab81c97e3659fb6f6e68933412 100644 (file)
@@ -129,14 +129,6 @@ VisuGUI_BuildProgressDlg::VisuGUI_BuildProgressDlg( QWidget* theParent ):
   myBuildFieldsButton->setPaletteBackgroundColor( Qt::red );
   connect( myBuildFieldsCheckBox, SIGNAL( clicked() ), this, SLOT( onBuildCheckBoxClicked() ) );
 
-  myBuildMinMaxCheckBox = new QCheckBox( tr( "BUILD_MINMAX" ), myProgressBox );
-  myBuildMinMaxCheckBox->setChecked( aResourceMgr->booleanValue( "VISU", "build_min_max", true ) );
-  myBuildMinMaxButton = new QPushButton( myProgressBox );
-  myBuildMinMaxButton->setEnabled( false );
-  myBuildMinMaxButton->setFixedSize( 30, 30 );
-  myBuildMinMaxButton->setPaletteBackgroundColor( Qt::red );
-  connect( myBuildMinMaxCheckBox, SIGNAL( clicked() ), this, SLOT( onBuildCheckBoxClicked() ) );
-
   myBuildGroupsCheckBox = new QCheckBox( tr( "BUILD_GROUPS" ), myProgressBox );
   myBuildGroupsCheckBox->setChecked( aResourceMgr->booleanValue( "VISU", "build_groups", true ) );
   myBuildGroupsButton = new QPushButton( myProgressBox );
@@ -149,10 +141,8 @@ VisuGUI_BuildProgressDlg::VisuGUI_BuildProgressDlg( QWidget* theParent ):
   aProgressLayout->addWidget( myBuildEntitiesButton,   0, 1 );
   aProgressLayout->addWidget( myBuildFieldsCheckBox,   1, 0 );
   aProgressLayout->addWidget( myBuildFieldsButton,     1, 1 );
-  aProgressLayout->addWidget( myBuildMinMaxCheckBox,   2, 0 );
-  aProgressLayout->addWidget( myBuildMinMaxButton,     2, 1 );
-  aProgressLayout->addWidget( myBuildGroupsCheckBox,   3, 0 );
-  aProgressLayout->addWidget( myBuildGroupsButton,     3, 1 );
+  aProgressLayout->addWidget( myBuildGroupsCheckBox,   2, 0 );
+  aProgressLayout->addWidget( myBuildGroupsButton,     2, 1 );
 
   // Time
   myTimeBox = new QGroupBox( tr( "IMPORT_TIME" ), this );
@@ -232,7 +222,7 @@ void VisuGUI_BuildProgressDlg::onStart()
                           tr("BUT_OK"));
     onClose();
   }else{
-    myResult->SetBuildFields( myBuildFieldsCheckBox->isChecked(), myBuildMinMaxCheckBox->isChecked() );
+    myResult->SetBuildFields( myBuildFieldsCheckBox->isChecked(), true );
     myResult->SetBuildGroups( myBuildGroupsCheckBox->isChecked() );
     
     //setModal( false );
@@ -319,8 +309,7 @@ void VisuGUI_BuildProgressDlg::onTimer()
       bool isGroupsDone = myResult->IsGroupsDone();
 
       updateButton( myBuildEntitiesButton, isEntitiesDone );
-      updateButton( myBuildFieldsButton, isFieldsDone );
-      updateButton( myBuildMinMaxButton, isMinMaxDone );
+      updateButton( myBuildFieldsButton, isFieldsDone && isMinMaxDone);
       updateButton( myBuildGroupsButton, isGroupsDone );
     }
 
@@ -406,14 +395,6 @@ void VisuGUI_BuildProgressDlg::onBuildCheckBoxClicked()
   else if( aCheckBox == myBuildFieldsCheckBox )
   {
     myBuildFieldsButton->setPaletteBackgroundColor( aColor );
-    if( !anIsChecked && myBuildMinMaxCheckBox->isChecked() )
-      myBuildMinMaxCheckBox->animateClick();
-  }
-  else if( aCheckBox == myBuildMinMaxCheckBox )
-  {
-    myBuildMinMaxButton->setPaletteBackgroundColor( aColor );
-    if( anIsChecked && !myBuildFieldsCheckBox->isChecked() )
-      myBuildFieldsCheckBox->animateClick();
   }
   else if( aCheckBox == myBuildGroupsCheckBox )
     myBuildGroupsButton->setPaletteBackgroundColor( aColor );
index 8284c52df99f15c9f709c2bc9d5f075b566ac573..3eb7c1a100cc63410976e7345e766c314a5229c5 100644 (file)
@@ -95,9 +95,6 @@ private:
   QCheckBox*       myBuildFieldsCheckBox;
   QPushButton*     myBuildFieldsButton;
 
-  QCheckBox*       myBuildMinMaxCheckBox;
-  QPushButton*     myBuildMinMaxButton;
-
   QCheckBox*       myBuildGroupsCheckBox;
   QPushButton*     myBuildGroupsButton;
 
index a7fc9d93cc7b4235c3ff2a41f3ac4f4190e2344d..8570ebd87558d44bf602cde269cd9a8c81adfc8e 100644 (file)
@@ -70,8 +70,9 @@
 using namespace std;
 
 VisuGUI_CutLinesDlg::VisuGUI_CutLinesDlg (SalomeApp_Module* theModule)
-  : VisuGUI_Prs3dDlg(theModule),
-    myPreviewActor(0),myPreviewActorGlyphs(0)
+  : VisuGUI_ScalarBarBaseDlg(theModule),
+    myPreviewActor(0),
+    myPreviewActorGlyphs(0)
 {
   setCaption("Cut Lines Definition");
   setSizeGripEnabled(true);
@@ -218,10 +219,8 @@ VisuGUI_CutLinesDlg::VisuGUI_CutLinesDlg (SalomeApp_Module* theModule)
 
   myTabBox->addTab( aLinesPane, tr("LBL_LINES_CUT") );
 
-  myScalarPane = new VisuGUI_ScalarBarPane(this, false);
-  myScalarPane->setMargin( 5 );
   myInputPane = new VisuGUI_InputPane(VISU::TCUTLINES, theModule, this);
-  myTabBox->addTab(myScalarPane, "Scalar Bar");
+  myTabBox->addTab(GetScalarPane(), "Scalar Bar");
   myTabBox->addTab(myInputPane, "Input");
 
   aMainLayout->addWidget(myTabBox);
@@ -284,12 +283,13 @@ VisuGUI_CutLinesDlg::~VisuGUI_CutLinesDlg()
 }
 
 //------------------------------------------------------------------------------
-void VisuGUI_CutLinesDlg::initFromPrsObject (VISU::ColoredPrs3d_i* thePrs, bool theInit)
+void VisuGUI_CutLinesDlg::initFromPrsObject ( VISU::ColoredPrs3d_i* thePrs,
+                                             bool theInit )
 {
   if( theInit )
     myPrsCopy = VISU::TSameAsFactory<VISU::TCUTLINES>().Create(thePrs, VISU::ColoredPrs3d_i::EDoNotPublish);
 
-  myScalarPane->initFromPrsObject(myPrsCopy);
+  VisuGUI_ScalarBarBaseDlg::initFromPrsObject(myPrsCopy, theInit);
 
   myRotXSpn->setValue(myPrsCopy->GetRotateX()*180./PI);
   myRotYSpn->setValue(myPrsCopy->GetRotateY()*180./PI);
@@ -326,11 +326,11 @@ void VisuGUI_CutLinesDlg::initFromPrsObject (VISU::ColoredPrs3d_i* thePrs, bool
 //------------------------------------------------------------------------------
 int VisuGUI_CutLinesDlg::storeToPrsObject (VISU::ColoredPrs3d_i* thePrs)
 {
-  if(!myInputPane->check() || !myScalarPane->check())
+  if(!myInputPane->check() || !GetScalarPane()->check())
     return 0;
   
   int anIsOk = myInputPane->storeToPrsObject( myPrsCopy );
-  anIsOk &= myScalarPane->storeToPrsObject( myPrsCopy );
+  anIsOk &= GetScalarPane()->storeToPrsObject( myPrsCopy );
 
   myPrsCopy->SetOrientation(getOrientaion(),
                            myRotXSpn->value()*PI/180.,
@@ -393,7 +393,6 @@ void VisuGUI_CutLinesDlg::createPlanes()
 void VisuGUI_CutLinesDlg::deletePlanes()
 {
   if (myPreviewActor == 0) return;
-  SVTK_ViewWindow* aView;
   vtkRenderer* aRend       = myPreviewActor->GetRenderer();
   vtkRenderer* aRendGlyphs = myPreviewActorGlyphs->GetRenderer();
   
@@ -404,12 +403,6 @@ void VisuGUI_CutLinesDlg::deletePlanes()
   if(aRendGlyphs && aWnd2)
     myPreviewActorGlyphs->RemoveFromRender(aRendGlyphs);
 
-//   Bug IPAL11962: preview is still in the viewer, if viewer not active.
-//   if (aView = VISU::GetActiveViewWindow<SVTK_ViewWindow>()){
-//     aView->RemoveActor(myPreviewActor);
-//     aView->RemoveActor(myPreviewActorGlyphs);
-//   } 
-
   myPreviewActor->Delete();
   myPreviewActorGlyphs->Delete();
   myPreviewActor = 0;
@@ -561,7 +554,6 @@ void VisuGUI_CutLinesDlg::DrawTable()
 void VisuGUI_CutLinesDlg::updateGlyphs(bool update){
   if (myPreviewActorGlyphs == 0 ) return;
   const vtkFloatingPointType *aDirLn = myCutLines->GetSpecificPL()->GetRealDirLn();
-  const vtkFloatingPointType *aBasePnt = myCutLines->GetSpecificPL()->GetBasePnt();
   vtkFloatingPointType aSecondPnt[3];
   vtkFloatingPointType aBoundCenter[3];
 
@@ -740,16 +732,12 @@ void VisuGUI_CutLinesDlg::onValueChanged (int theRow, int theCol)
 
 void VisuGUI_CutLinesDlg::accept()
 {
-    myScalarPane->deletePreview();
-    deletePlanes();
-    QDialog::accept();
+  VisuGUI_ScalarBarBaseDlg::accept();
 }
 
 void VisuGUI_CutLinesDlg::reject()
 {
-  myScalarPane->deletePreview();
-  deletePlanes();
-  QDialog::reject();
+  VisuGUI_ScalarBarBaseDlg::reject();
 }
 
 void VisuGUI_CutLinesDlg::onPreviewCheck (bool thePreview)
@@ -803,43 +791,7 @@ void VisuGUI_CutLinesDlg::onPlanePos (const QString& theValue)
   }
 }
 
-void VisuGUI_CutLinesDlg::onHelp()
-{
-  QString aHelpFileName = "/files/cut_lines_presentation.htm";
-  LightApp_Application* app = (LightApp_Application*)(SUIT_Session::session()->activeApplication());
-  if (app) {
-    VisuGUI* aVisuGUI = dynamic_cast<VisuGUI*>( app->activeModule() );
-    app->onHelpContextModule(aVisuGUI ? app->moduleName(aVisuGUI->moduleName()) : QString(""), aHelpFileName);
-  }
-  else {
-               QString platform;
-#ifdef WIN32
-               platform = "winapplication";
-#else
-               platform = "application";
-#endif
-    SUIT_MessageBox::warn1(0, QObject::tr("WRN_WARNING"),
-                          QObject::tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
-                          arg(app->resourceMgr()->stringValue("ExternalBrowser", platform)).arg(aHelpFileName),
-                          QObject::tr("BUT_OK"));
-  }
-}
-
-//jfa tmp:void VisuGUI_CutLinesDlg::onWindowActivated (SUIT_ViewWindow* theWnd)
-//jfa tmp:{
-//jfa tmp:  if (theWnd != myStudyWnd)
-//jfa tmp:    reject();
-//jfa tmp:}
-
-void VisuGUI_CutLinesDlg::keyPressEvent( QKeyEvent* e )
+QString VisuGUI_CutLinesDlg::GetContextHelpFilePath()
 {
-  QDialog::keyPressEvent( e );
-  if ( e->isAccepted() )
-    return;
-
-  if ( e->key() == Key_F1 )
-    {
-      e->accept();
-      onHelp();
-    }
+  return "/files/cut_lines_presentation.htm";
 }
index 52142bdfbf04864bf8126a5c6144bfa7267553df..2d0b1fb26d6df100377143a5ed457cae578030b0 100644 (file)
@@ -42,7 +42,7 @@ namespace VISU
   class CutLines_i;
 }
 
-class VisuGUI_CutLinesDlg: public VisuGUI_Prs3dDlg
+class VisuGUI_CutLinesDlg: public VisuGUI_ScalarBarBaseDlg
 {
     Q_OBJECT
 
@@ -50,15 +50,17 @@ public:
     VisuGUI_CutLinesDlg (SalomeApp_Module* theModule);
     ~VisuGUI_CutLinesDlg();
 
-    virtual void initFromPrsObject(VISU::ColoredPrs3d_i* thePrs, bool theInit = true);
+    virtual void initFromPrsObject( VISU::ColoredPrs3d_i* thePrs,
+                                   bool theInit );
+
     virtual int  storeToPrsObject(VISU::ColoredPrs3d_i* thePrs);
 
     bool isGenerateTable() { return myCreateTable->isChecked(); }
     bool isGenerateCurves() { return myCreateTable->isChecked() && myCurvesCheck->isChecked(); }
 
-private:
-    void keyPressEvent( QKeyEvent* e );
-
+protected:
+  virtual QString GetContextHelpFilePath();
 protected slots:
   void accept();
   void reject();
@@ -74,8 +76,6 @@ private slots:
   void onAllCurvesInvertedCheck(bool theInvert);
   void onRotation (double theValue);
   void onPlanePos (const QString& theValue);
-  void onHelp();
-  //jfa tmp:void onWindowActivated (SUIT_ViewWindow*);
 
 private:
   void createPlanes();
@@ -107,7 +107,6 @@ private:
   SALOME::GenericObjPtr<VISU::CutLines_i> myCutLines;
 
   QTabWidget*            myTabBox;
-  VisuGUI_ScalarBarPane* myScalarPane;
   VisuGUI_InputPane*     myInputPane;
 
   VISU::CutPlanes::Orientation getOrientaion (bool IsBasePlane = true);
index 8006fd486a5bdf0b360826bc6c5c7b5bdc6cf0d3..9a0033c8b0c574768e1a1ddab66167c525fb91dc 100644 (file)
@@ -472,7 +472,7 @@ void VisuGUI_CutPlanesPane::onPreviewCheck (bool thePreview)
   Constructor
 */
 VisuGUI_CutPlanesDlg::VisuGUI_CutPlanesDlg (SalomeApp_Module* theModule)
-  : VisuGUI_Prs3dDlg(theModule)
+  : VisuGUI_ScalarBarBaseDlg(theModule)
 {
   setCaption("Cut Planes Definition");
   setSizeGripEnabled(true);
@@ -485,10 +485,8 @@ VisuGUI_CutPlanesDlg::VisuGUI_CutPlanesDlg (SalomeApp_Module* theModule)
   myTabBox = new QTabWidget(this);
   myCutPane = new VisuGUI_CutPlanesPane(this/*, myMgr*/);
   myTabBox->addTab(myCutPane, "Cut Planes");
-  myScalarPane = new VisuGUI_ScalarBarPane(this, false);
-  myScalarPane->setMargin(5);
   myInputPane = new VisuGUI_InputPane(VISU::TCUTPLANES, theModule, this);
-  myTabBox->addTab(myScalarPane, "Scalar Bar");
+  myTabBox->addTab(GetScalarPane(), "Scalar Bar");
   myTabBox->addTab(myInputPane, "Input");
 
   TopLayout->addWidget(myTabBox);
@@ -523,39 +521,35 @@ VisuGUI_CutPlanesDlg::VisuGUI_CutPlanesDlg (SalomeApp_Module* theModule)
   connect(buttonOk,     SIGNAL(clicked()), this, SLOT(accept()));
   connect(buttonCancel, SIGNAL(clicked()), this, SLOT(reject()));
   connect(buttonHelp,   SIGNAL(clicked()), this, SLOT(onHelp()));
-  //connect(myMgr, SIGNAL(closeAllViews()), this, SLOT(reject()));
-  //connect(VisuGUI::application()->desktop(),
-  //        SIGNAL(windowActivated(SUIT_ViewWindow*)),
-  //        this, SLOT(onWindowActivated(SUIT_ViewWindow*)));
 }
 
 VisuGUI_CutPlanesDlg::~VisuGUI_CutPlanesDlg()
 {}
 
-void VisuGUI_CutPlanesDlg::initFromPrsObject (VISU::ColoredPrs3d_i* thePrs, bool theInit)
+void VisuGUI_CutPlanesDlg::initFromPrsObject ( VISU::ColoredPrs3d_i* thePrs,
+                                              bool theInit )
 {
   if( theInit )
     myPrsCopy = VISU::TSameAsFactory<VISU::TCUTPLANES>().Create(thePrs, VISU::ColoredPrs3d_i::EDoNotPublish);
 
-  myScalarPane->initFromPrsObject( myPrsCopy );
+  VisuGUI_ScalarBarBaseDlg::initFromPrsObject(myPrsCopy, theInit);
+
+  myCutPane->initFromPrsObject(myPrsCopy);
 
   if( !theInit )
     return;
 
-  myScalarPane->initFromPrsObject(myPrsCopy);
-  myCutPane->initFromPrsObject(myPrsCopy);
-
   myInputPane->initFromPrsObject( myPrsCopy );
   myTabBox->setCurrentPage( 0 );
 }
 
 int VisuGUI_CutPlanesDlg::storeToPrsObject (VISU::ColoredPrs3d_i* thePrs)
 {
-  if(!myInputPane->check() || !myScalarPane->check())
+  if(!myInputPane->check() || !GetScalarPane()->check())
     return 0;
 
   int anIsOk = myInputPane->storeToPrsObject(myPrsCopy);
-  anIsOk &= myScalarPane->storeToPrsObject(myPrsCopy);
+  anIsOk &= GetScalarPane()->storeToPrsObject(myPrsCopy);
   anIsOk &= myCutPane->storeToPrsObject(myPrsCopy);
 
   VISU::TSameAsFactory<VISU::TCUTPLANES>().Copy(myPrsCopy, thePrs);
@@ -565,50 +559,19 @@ int VisuGUI_CutPlanesDlg::storeToPrsObject (VISU::ColoredPrs3d_i* thePrs)
 
 void VisuGUI_CutPlanesDlg::accept()
 {
-  //if ( !VisuGUI::CheckActiveStudyLock() ) {
-  //  reject();
-  //  return;
-  //}
-  if (myScalarPane->check())
-    {
-      myScalarPane->deletePreview();
-      QDialog::accept();
-    }
+  VisuGUI_ScalarBarBaseDlg::accept();
 }
 
-void VisuGUI_CutPlanesDlg::reject() {
-  myScalarPane->deletePreview();
-  QDialog::reject();
+void VisuGUI_CutPlanesDlg::reject() 
+{
+  VisuGUI_ScalarBarBaseDlg::reject();
 }
 
-void VisuGUI_CutPlanesDlg::onHelp()
+QString VisuGUI_CutPlanesDlg::GetContextHelpFilePath()
 {
-  QString aHelpFileName = "/files/cut_lines_resentation.htm";
-  LightApp_Application* app = (LightApp_Application*)(SUIT_Session::session()->activeApplication());
-  if (app) {
-    VisuGUI* aVisuGUI = dynamic_cast<VisuGUI*>( app->activeModule() );
-    app->onHelpContextModule(aVisuGUI ? app->moduleName(aVisuGUI->moduleName()) : QString(""), aHelpFileName);
-  }
-  else {
-               QString platform;
-#ifdef WIN32
-               platform = "winapplication";
-#else
-               platform = "application";
-#endif
-    SUIT_MessageBox::warn1(0, QObject::tr("WRN_WARNING"),
-                          QObject::tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
-                          arg(app->resourceMgr()->stringValue("ExternalBrowser", platform)).arg(aHelpFileName),
-                          QObject::tr("BUT_OK"));
-  }
+  return "/files/cut_lines_resentation.htm";
 }
 
-//void VisuGUI_CutPlanesDlg::onWindowActivated (SUIT_ViewWindow* theWnd)
-//{
-//  if (theWnd != myStudyWnd)
-//    reject();
-//}
-
 //###################################################################
 
 QWidget* VisuGUI_NumEditItem::createEditor() const
@@ -619,16 +582,3 @@ QWidget* VisuGUI_NumEditItem::createEditor() const
   editline->setValidator(dvalidator);
   return editline;
 }
-
-void VisuGUI_CutPlanesDlg::keyPressEvent( QKeyEvent* e )
-{
-  QDialog::keyPressEvent( e );
-  if ( e->isAccepted() )
-    return;
-
-  if ( e->key() == Key_F1 )
-    {
-      e->accept();
-      onHelp();
-    }
-}
index 9f2ad6ccd5e760fff870b2e64e8a4a77ded0d104..9b029d90c5981c47f7c4ab366bef9e70b69ff8cd 100644 (file)
@@ -76,7 +76,6 @@ private:
     void createPlanes();
     void deletePlanes();
 
-
     QLabel* LabelRot1;
     QLabel* LabelRot2;
     QSpinBox* nbPlan;
@@ -97,7 +96,6 @@ private:
     SALOME_Actor* myPreviewActor;
 
 private slots:
-//VSR: 08/06/06:     void editScalarBar();
     void orientationChanged( int );
     void DrawTable();
     void setDefault( int all = -1);
@@ -107,7 +105,7 @@ private slots:
 };
 
 
-class VisuGUI_CutPlanesDlg : public VisuGUI_Prs3dDlg
+class VisuGUI_CutPlanesDlg : public VisuGUI_ScalarBarBaseDlg
 {
     Q_OBJECT
 
@@ -115,22 +113,21 @@ public:
     VisuGUI_CutPlanesDlg (SalomeApp_Module* theModule);
     ~VisuGUI_CutPlanesDlg();
 
-    virtual void initFromPrsObject(VISU::ColoredPrs3d_i* thePrs, bool theInit = true);
+    virtual void initFromPrsObject( VISU::ColoredPrs3d_i* thePrs,
+                                   bool theInit );
+
     virtual int  storeToPrsObject(VISU::ColoredPrs3d_i* thePrs);
 
-private:
-    void keyPressEvent( QKeyEvent* e );
-  
+protected:
+    virtual QString        GetContextHelpFilePath();
+
 protected slots:
     void accept();
     void reject();
-//VSR: 08/06/06:     void onWindowActivated (SUIT_ViewWindow*);
-    void onHelp();
 
 private:
     QTabWidget*            myTabBox;
     VisuGUI_CutPlanesPane* myCutPane;
-    VisuGUI_ScalarBarPane* myScalarPane;
     VisuGUI_InputPane*     myInputPane;
     SALOME::GenericObjPtr<VISU::CutPlanes_i> myPrsCopy;
 };
index 3f06d6a192e51dfbe9e8ef061078a6c0f6347c3b..503fbabd00f0d2d91e1eadf6622672a8186db219 100644 (file)
@@ -51,7 +51,7 @@ using namespace std;
  * Constructor
  */
 VisuGUI_DeformedShapeDlg::VisuGUI_DeformedShapeDlg (SalomeApp_Module* theModule)
-  : VisuGUI_Prs3dDlg(theModule)
+  : VisuGUI_ScalarBarBaseDlg(theModule)
 {
   setCaption(tr("DLG_TITLE"));
   setSizeGripEnabled(TRUE);
@@ -91,11 +91,9 @@ VisuGUI_DeformedShapeDlg::VisuGUI_DeformedShapeDlg (SalomeApp_Module* theModule)
   myTabBox->addTab(aBox, tr("DEFORMED_SHAPE_TAB"));
 
   // Scalar bar pane
-  myScalarPane = new VisuGUI_ScalarBarPane (this, false);
-  myScalarPane->setMargin(5);
   myInputPane = new VisuGUI_InputPane(VISU::TDEFORMEDSHAPE, theModule, this);
 
-  myTabBox->addTab(myScalarPane, tr("SCALAR_BAR_TAB"));
+  myTabBox->addTab(GetScalarPane(), tr("SCALAR_BAR_TAB"));
   myTabBox->addTab(myInputPane, tr("INPUT_TAB"));
 
   // Buttons
@@ -138,12 +136,13 @@ VisuGUI_DeformedShapeDlg::VisuGUI_DeformedShapeDlg (SalomeApp_Module* theModule)
 VisuGUI_DeformedShapeDlg::~VisuGUI_DeformedShapeDlg()
 {}
 
-void VisuGUI_DeformedShapeDlg::initFromPrsObject (VISU::ColoredPrs3d_i* thePrs, bool theInit)
+void VisuGUI_DeformedShapeDlg::initFromPrsObject ( VISU::ColoredPrs3d_i* thePrs,
+                                                  bool theInit )
 {
   if( theInit )
     myPrsCopy = VISU::TSameAsFactory<VISU::TDEFORMEDSHAPE>().Create(thePrs, VISU::ColoredPrs3d_i::EDoNotPublish);
 
-  myScalarPane->initFromPrsObject( myPrsCopy );
+  VisuGUI_ScalarBarBaseDlg::initFromPrsObject(myPrsCopy, theInit);
 
   setFactor(myPrsCopy->GetScale());
   UseMagn->setChecked(myPrsCopy->IsColored());
@@ -157,11 +156,11 @@ void VisuGUI_DeformedShapeDlg::initFromPrsObject (VISU::ColoredPrs3d_i* thePrs,
 
 int VisuGUI_DeformedShapeDlg::storeToPrsObject(VISU::ColoredPrs3d_i* thePrs) 
 {
-  if(!myInputPane->check() || !myScalarPane->check())
+  if(!myInputPane->check() || !GetScalarPane()->check())
     return 0;
 
   int anIsOk = myInputPane->storeToPrsObject( myPrsCopy );
-  anIsOk &= myScalarPane->storeToPrsObject( myPrsCopy );
+  anIsOk &= GetScalarPane()->storeToPrsObject( myPrsCopy );
 
   myPrsCopy->SetScale(getFactor());
   myPrsCopy->ShowColored(isColored());
@@ -171,51 +170,17 @@ int VisuGUI_DeformedShapeDlg::storeToPrsObject(VISU::ColoredPrs3d_i* thePrs)
   return anIsOk;
 }
 
-void VisuGUI_DeformedShapeDlg::accept() {
-  if (myScalarPane->check()) 
-    {
-      myScalarPane->deletePreview();
-      QDialog::accept();
-    }
-}
-
-void VisuGUI_DeformedShapeDlg::reject()
+void VisuGUI_DeformedShapeDlg::accept() 
 {
-  myScalarPane->deletePreview();
-  QDialog::reject();
+  VisuGUI_ScalarBarBaseDlg::accept();
 }
 
-void VisuGUI_DeformedShapeDlg::onHelp()
+void VisuGUI_DeformedShapeDlg::reject()
 {
-  QString aHelpFileName = "/files/deformed_shape_presentation.htm";
-  LightApp_Application* app = (LightApp_Application*)(SUIT_Session::session()->activeApplication());
-  if (app) {
-    VisuGUI* aVisuGUI = dynamic_cast<VisuGUI*>( app->activeModule() );
-    app->onHelpContextModule(aVisuGUI ? app->moduleName(aVisuGUI->moduleName()) : QString(""), aHelpFileName);
-  }
-  else {
-               QString platform;
-#ifdef WIN32
-               platform = "winapplication";
-#else
-               platform = "application";
-#endif
-    SUIT_MessageBox::warn1(0, QObject::tr("WRN_WARNING"),
-                          QObject::tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
-                          arg(app->resourceMgr()->stringValue("ExternalBrowser", platform)).arg(aHelpFileName),
-                          QObject::tr("BUT_OK"));
-  }
+  VisuGUI_ScalarBarBaseDlg::reject();
 }
 
-void VisuGUI_DeformedShapeDlg::keyPressEvent( QKeyEvent* e )
+QString VisuGUI_DeformedShapeDlg::GetContextHelpFilePath()
 {
-  QDialog::keyPressEvent( e );
-  if ( e->isAccepted() )
-    return;
-
-  if ( e->key() == Key_F1 )
-    {
-      e->accept();
-      onHelp();
-    }
+  return "/files/deformed_shape_presentation.htm";
 }
index a832a9db59cc1b3307aa02dc1189fcc3885826af..2d6d1edf9f342af1506fdef9983506442cfe8b15 100644 (file)
@@ -48,7 +48,7 @@ namespace VISU
   class DeformedShape_i;
 }
 
-class VisuGUI_DeformedShapeDlg : public VisuGUI_Prs3dDlg
+class VisuGUI_DeformedShapeDlg : public VisuGUI_ScalarBarBaseDlg
 {
     Q_OBJECT
 
@@ -64,22 +64,22 @@ public:
     bool isColored()
       { return UseMagn->isChecked(); }
 
-    virtual void initFromPrsObject(VISU::ColoredPrs3d_i* thePrs, bool theInit = true);
+    virtual void initFromPrsObject( VISU::ColoredPrs3d_i* thePrs,
+                                 bool theInit );
+
     virtual int  storeToPrsObject(VISU::ColoredPrs3d_i* thePrs);
 
-private:
-    void keyPressEvent( QKeyEvent* e );
+protected:
+    virtual QString        GetContextHelpFilePath();
 
 protected slots:
   void accept();
   void reject();
-  void onHelp();
 
- private:
+private:
     QtxDblSpinBox* ScalFact;
     QCheckBox* UseMagn;
     QTabWidget*            myTabBox;
-    VisuGUI_ScalarBarPane* myScalarPane;
     VisuGUI_InputPane*     myInputPane;
     SALOME::GenericObjPtr<VISU::DeformedShape_i> myPrsCopy;
 };
index 6a66425d773bbae5cde36bb6586c371f59fd2e68..5e0b3fc13c86aa9e276650061883ee55e11bbe66 100644 (file)
@@ -74,7 +74,7 @@
 
 using namespace std;
 
-VisuGUI_GaussScalarBarPane::VisuGUI_GaussScalarBarPane (QWidget * parent, bool SetPref):
+VisuGUI_GaussScalarBarPane::VisuGUI_GaussScalarBarPane (QWidget * parent):
   QVBox(parent)
 {
   myVerX = 0.01;  myVerY = 0.10;  myVerW = 0.10;  myVerH = 0.80;
@@ -276,18 +276,10 @@ VisuGUI_GaussScalarBarPane::VisuGUI_GaussScalarBarPane (QWidget * parent, bool S
 
   //TopLayout->addWidget( DimGroup );
 
-  // Save check box ===========================================================
   QHBox* aSaveBox = new QHBox(this);
-  if (!SetPref) {
-    CBSave = new QCheckBox (tr("SAVE_DEFAULT_CHK"), aSaveBox, "CBSave");
-    //TopLayout->addWidget(CBSave);
-  }
-  else {
-    CBSave = 0;
-  }
   myTextBtn = new QPushButton("Text properties...", aSaveBox);
   myTextDlg = new VisuGUI_TextPrefDlg(this);
-  myTextDlg->setTitleVisible(!SetPref);
+  myTextDlg->setTitleVisible(true);
 
   // signals and slots connections ===========================================
   connect( RBFieldRange,    SIGNAL( clicked() ), this, SLOT( fieldRangeClicked() ) );
@@ -451,7 +443,7 @@ void VisuGUI_GaussScalarBarPane::initFromPrsObject(VISU::GaussPoints_i* thePrs)
   bool isScalarMode = (aNbComp > 1);
   myModeCombo->clear();
   myModeCombo->insertItem("<Modulus>");
-  const VISU::PField& aField = thePrs->GetField();
+  VISU::PField aField = thePrs->GetField();
   const VISU::TNames& aCompNames = aField->myCompNames;
   const VISU::TNames& aUnitNames = aField->myUnitNames;
   for(int i = 0; i < aNbComp; i++){
@@ -523,8 +515,6 @@ int VisuGUI_GaussScalarBarPane::storeToPrsObject(VISU::GaussPoints_i* thePrs) {
   thePrs->SetNbColors(ColorSpin->value());
   thePrs->SetLabels(LabelSpin->value());
 
-  //if (isToSave()) storeToResources();
-
   if (myIsStoreTextProp) {
     // "Title"
     thePrs->SetTitle(myTextDlg->getTitleText().latin1());
@@ -670,10 +660,6 @@ int VisuGUI_GaussScalarBarPane::getNbLabels() {
   return LabelSpin->value();
 }
 
-bool VisuGUI_GaussScalarBarPane::isToSave() {
-  return CBSave ? CBSave->isChecked() : false;
-}
-
 void VisuGUI_GaussScalarBarPane::onTextPref()
 {
   myIsStoreTextProp = myTextDlg->exec();
@@ -683,11 +669,11 @@ void VisuGUI_GaussScalarBarPane::onTextPref()
 /*!
  * Constructor
  */
-VisuGUI_GaussPointsDlg::VisuGUI_GaussPointsDlg(SalomeApp_Module* theModule, bool SetPref):
+VisuGUI_GaussPointsDlg::VisuGUI_GaussPointsDlg(SalomeApp_Module* theModule):
   VisuGUI_Prs3dDlg(theModule)
 {
-  setName("VisuGUI_ScalarBarDlg");
-  setCaption(SetPref ? tr("DLG_PREF_TITLE") : tr("DLG_PROP_TITLE"));
+  setName("VisuGUI_GaussPointsDlg");
+  setCaption(tr("DLG_PROP_TITLE"));
   setSizeGripEnabled(TRUE);
 
   QVBoxLayout* TopLayout = new QVBoxLayout(this);
@@ -736,7 +722,7 @@ VisuGUI_GaussPointsDlg::VisuGUI_GaussPointsDlg(SalomeApp_Module* theModule, bool
   aDefShapeLayout->addWidget( myScaleSpinBox, 0, 1 );
 
   // Scalar Bar pane
-  myScalarPane = new VisuGUI_GaussScalarBarPane(this, SetPref);
+  myScalarPane = new VisuGUI_GaussScalarBarPane(this);
   myScalarPane->setMargin(5);
 
   // Input pane
@@ -788,7 +774,8 @@ VisuGUI_GaussPointsDlg::VisuGUI_GaussPointsDlg(SalomeApp_Module* theModule, bool
 VisuGUI_GaussPointsDlg::~VisuGUI_GaussPointsDlg()
 {}
 
-void VisuGUI_GaussPointsDlg::initFromPrsObject(VISU::ColoredPrs3d_i* thePrs, bool theInit)
+void VisuGUI_GaussPointsDlg::initFromPrsObject( VISU::ColoredPrs3d_i* thePrs,
+                                               bool theInit )
 {
   if( theInit )
     myPrsCopy = VISU::TSameAsFactory<VISU::TGAUSSPOINTS>().Create(thePrs, VISU::ColoredPrs3d_i::EDoNotPublish);
@@ -896,7 +883,7 @@ void VisuGUI_GaussPointsDlg::accept()
   if( (bool)myPrsCopy && myPrimitiveBox->getPrimitiveType() == VISU_OpenGLPointSpriteMapper::GeomSphere )
   {
     int aNumberOfFaces = myPrimitiveBox->getFaceNumber();
-    int aNumberOfPoints = ( (vtkPolyData*)myPrsCopy->GetSpecificPL()->GetInput() )->GetNumberOfCells();
+    int aNumberOfPoints = myPrsCopy->GetSpecificPL()->GetInput()->GetNumberOfCells();
 
     if( aNumberOfFaces * aNumberOfPoints > myPrimitiveBox->getFaceLimit() )
     {
@@ -931,38 +918,10 @@ void VisuGUI_GaussPointsDlg::accept()
   }
 
   //if( myScalarPane->check() )
-  QDialog::accept();
+  VisuGUI_Prs3dDlg::accept();
 }
 
-void VisuGUI_GaussPointsDlg::onHelp()
+QString VisuGUI_GaussPointsDlg::GetContextHelpFilePath()
 {
-  QString aHelpFileName = "types_of_gauss_points_presentations.htm";
-  LightApp_Application* app = (LightApp_Application*)(SUIT_Session::session()->activeApplication());
-  if (app)
-    app->onHelpContextModule(app->activeModule() ? app->moduleName(app->activeModule()->moduleName()) : QString(""), aHelpFileName);
-  else {
-               QString platform;
-#ifdef WIN32
-               platform = "winapplication";
-#else
-               platform = "application";
-#endif
-    SUIT_MessageBox::warn1(0, QObject::tr("WRN_WARNING"),
-                          QObject::tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
-                          arg(app->resourceMgr()->stringValue("ExternalBrowser", platform)).arg(aHelpFileName),
-                          QObject::tr("BUT_OK"));
-  }
-}
-
-void VisuGUI_GaussPointsDlg::keyPressEvent( QKeyEvent* e )
-{
-  QDialog::keyPressEvent( e );
-  if ( e->isAccepted() )
-    return;
-
-  if ( e->key() == Key_F1 )
-    {
-      e->accept();
-      onHelp();
-    }
+  return "types_of_gauss_points_presentations.htm";
 }
index e0962e51136347fa760665a70e1eb821240f3202..7bd912df13da504600208f946cdd4a425962ec15 100644 (file)
@@ -49,7 +49,7 @@ class VisuGUI_GaussScalarBarPane : public QVBox
   Q_OBJECT
 
  public:
-  VisuGUI_GaussScalarBarPane(QWidget* parent, bool SetPref);
+  VisuGUI_GaussScalarBarPane(QWidget* parent);
   ~VisuGUI_GaussScalarBarPane() {};
 
   int     getOrientation();
@@ -61,7 +61,6 @@ class VisuGUI_GaussScalarBarPane : public QVBox
   double  getHeight();
   int     getNbColors();
   int     getNbLabels();
-  bool    isToSave();
 
   void    initFromPrsObject(VISU::GaussPoints_i* thePrs);
   int     storeToPrsObject(VISU::GaussPoints_i* thePrs);
@@ -91,7 +90,6 @@ class VisuGUI_GaussScalarBarPane : public QVBox
   QLabel*         LabelLabel;
   QSpinBox*       LabelSpin;
 
-  QCheckBox*      CBSave;
   QLabel*         myModeLbl;
   QComboBox*      myModeCombo;
   QPushButton*    myTextBtn;
@@ -129,22 +127,21 @@ class VisuGUI_GaussPointsDlg : public VisuGUI_Prs3dDlg
   Q_OBJECT
 
 public:
-  VisuGUI_GaussPointsDlg (SalomeApp_Module* theModule, bool SetPref = FALSE);
+  VisuGUI_GaussPointsDlg (SalomeApp_Module* theModule);
   ~VisuGUI_GaussPointsDlg();
 
   //! Initializing dialog from the Gauss Points presentation.
-  virtual void    initFromPrsObject(VISU::ColoredPrs3d_i* thePrs, bool theInit = true);
+  virtual void    initFromPrsObject( VISU::ColoredPrs3d_i* thePrs,
+                                    bool theInit );
 
   //! Update Gauss Points presentation using parameters from the dialog.
   virtual int     storeToPrsObject(VISU::ColoredPrs3d_i* thePrs);
 
-private:
-  void keyPressEvent( QKeyEvent* e );
-
+protected:
+  virtual QString GetContextHelpFilePath();
 protected slots:
   void    onToggleDefShape( bool );
-  void    onHelp();
-
   void    accept();
 
 private:
index 13a32591fa7cfb63dd0f8e602ad561ebc870860d..b74d15f343ba48816c20b5940c7b05172993d1c5 100644 (file)
 using namespace std;
 
 
-VisuGUI_IsoSurfPane::VisuGUI_IsoSurfPane (QWidget* parent)
-     : QVBox(parent)
+VisuGUI_IsoSurfPane::VisuGUI_IsoSurfPane (QWidget* parent,
+                                         VisuGUI_ScalarBarPane* theScalarPane)
+  : QVBox(parent),
+    myScalarPane(theScalarPane)
 {
   QFrame* TopGroup = new QFrame( this, "TopGroup" );
   TopGroup->setFrameStyle(QFrame::Box | QFrame::Sunken);
@@ -88,18 +90,9 @@ VisuGUI_IsoSurfPane::VisuGUI_IsoSurfPane (QWidget* parent)
   LabelMax->setBuddy(MaxIso);
   TopGroupLayout->addWidget( MaxIso, 2, 1 );
 
-
-//   CBUpdate = new QCheckBox ( tr( "Update scalar bar with these values" ), TopGroup);
-//   CBUpdate->setSizePolicy( QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed) );
-//   TopGroupLayout->addMultiCellWidget( CBUpdate, 4, 4, 0, 1);
-//   CBUpdate->setChecked(false);
   QPushButton* aUpdateBtn = new QPushButton( "Update scalar bar range with these values", TopGroup);
   TopGroupLayout->addMultiCellWidget( aUpdateBtn, 3, 3, 0, 1);
   connect( aUpdateBtn, SIGNAL( clicked() ), this, SLOT(onCBUpdate() ) );
-
-//   CBLog = new QCheckBox ( tr( "Logarithmic scaling" ), TopGroup);
-//   CBLog->setSizePolicy( QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed) );
-//   TopGroupLayout->addMultiCellWidget( CBLog, 3, 3, 0, 1);
 }
 
 void VisuGUI_IsoSurfPane::initFromPrsObject (VISU::IsoSurfaces_i* thePrs)
@@ -107,13 +100,6 @@ void VisuGUI_IsoSurfPane::initFromPrsObject (VISU::IsoSurfaces_i* thePrs)
   NbrIso->setValue(thePrs->GetNbSurfaces());
   MinIso->setText(QString::number(thePrs->GetSubMin()));
   MaxIso->setText(QString::number(thePrs->GetSubMax()));
-//   switch(thePrs->GetScaling()){
-//   case VISU::LOGARITHMIC :
-//     CBLog->setChecked(true);
-//     break;
-//   default:
-//     CBLog->setChecked(false);
-//   }
 }
 
 int VisuGUI_IsoSurfPane::storeToPrsObject (VISU::IsoSurfaces_i* thePrs)
@@ -121,23 +107,11 @@ int VisuGUI_IsoSurfPane::storeToPrsObject (VISU::IsoSurfaces_i* thePrs)
   thePrs->SetNbSurfaces(NbrIso->value());
   thePrs->SetSubRange(MinIso->text().toDouble(), MaxIso->text().toDouble());
   return 1;
-//   if (CBUpdate->isChecked())
-//     {
-//       thePrs->SetRange(MinIso->text().toDouble(), MaxIso->text().toDouble());
-//       if (CBLog->isChecked())
-//     thePrs->SetScaling(VISU::LOGARITHMIC);
-//       else
-//     thePrs->SetScaling(VISU::LINEAR);
-//    }
 }
 
 void VisuGUI_IsoSurfPane::onCBUpdate()
 {
-  //  if (CBUpdate->isChecked()) {
   myScalarPane->setRange(MinIso->text().toDouble(), MaxIso->text().toDouble(), true);
-    //  }
-//     CBLog->setDisabled(false);
-//   else CBLog->setDisabled(true);
 }
 
 bool VisuGUI_IsoSurfPane::check()
@@ -148,14 +122,7 @@ bool VisuGUI_IsoSurfPane::check()
                            tr("MSG_MINMAX_VALUES"),
                            tr("BUT_OK"));
     return false;
-  } // else if (/* CBUpdate->isChecked() && CBLog->isChecked() && */
-//           (MinIso->text().toDouble() <=0 || MaxIso->text().toDouble() <=0) ) {
-//     SUIT_MessageBox::warn1( this,
-//                        tr("WRN_VISU"),
-//                        tr("WRN_LOGARITHMIC_RANGE_ISOSURF"),
-//                        tr("BUT_OK"));
-//     return false;
-//   }
+  } 
   return true;
 }
 
@@ -167,7 +134,7 @@ bool VisuGUI_IsoSurfPane::check()
   Constructor
 */
 VisuGUI_IsoSurfacesDlg::VisuGUI_IsoSurfacesDlg (SalomeApp_Module* theModule)
-  : VisuGUI_Prs3dDlg(theModule)
+  : VisuGUI_ScalarBarBaseDlg(theModule)
 {
   setCaption(tr("DEFINE_ISOSURFACES"));
   setSizeGripEnabled( TRUE );
@@ -177,14 +144,11 @@ VisuGUI_IsoSurfacesDlg::VisuGUI_IsoSurfacesDlg (SalomeApp_Module* theModule)
   TopLayout->setMargin(11);
 
   myTabBox = new QTabWidget(this);
-  myIsoPane = new  VisuGUI_IsoSurfPane(this);
+  myIsoPane = new  VisuGUI_IsoSurfPane(this, GetScalarPane());
   myIsoPane->setMargin( 5 );
   myTabBox->addTab(myIsoPane, "Iso Surface");
-  myScalarPane = new VisuGUI_ScalarBarPane(this, false);
-  myIsoPane->setScalarBarPane(myScalarPane);
-  myScalarPane->setMargin( 5 );
   myInputPane = new VisuGUI_InputPane(VISU::TISOSURFACES, theModule, this);
-  myTabBox->addTab(myScalarPane, "Scalar Bar");
+  myTabBox->addTab(GetScalarPane(), "Scalar Bar");
   myTabBox->addTab(myInputPane, "Input");
 
   TopLayout->addWidget(myTabBox);
@@ -224,25 +188,18 @@ VisuGUI_IsoSurfacesDlg::~VisuGUI_IsoSurfacesDlg()
 
 void VisuGUI_IsoSurfacesDlg::accept()
 {
-  if (myIsoPane->check() && myScalarPane->check())
-    {
-      myScalarPane->deletePreview();
-      QDialog::accept();
-    }
-}
-
-void VisuGUI_IsoSurfacesDlg::reject()
-{
-  myScalarPane->deletePreview();
-  QDialog::reject();
+  if ( myIsoPane->check() )
+    VisuGUI_ScalarBarBaseDlg::accept();
 }
 
-void VisuGUI_IsoSurfacesDlg::initFromPrsObject(VISU::ColoredPrs3d_i* thePrs, bool theInit)
+void VisuGUI_IsoSurfacesDlg::initFromPrsObject( VISU::ColoredPrs3d_i* thePrs,
+                                               bool theInit )
 {
   if( theInit )
     myPrsCopy = VISU::TSameAsFactory<VISU::TISOSURFACES>().Create(thePrs, VISU::ColoredPrs3d_i::EDoNotPublish);
 
-  myScalarPane->initFromPrsObject(myPrsCopy);
+  VisuGUI_ScalarBarBaseDlg::initFromPrsObject(myPrsCopy, theInit);
+
   myIsoPane->initFromPrsObject(myPrsCopy);
 
   if( !theInit )
@@ -254,11 +211,11 @@ void VisuGUI_IsoSurfacesDlg::initFromPrsObject(VISU::ColoredPrs3d_i* thePrs, boo
 
 int VisuGUI_IsoSurfacesDlg::storeToPrsObject(VISU::ColoredPrs3d_i* thePrs)
 {
-  if(!myInputPane->check() || !myScalarPane->check())
+  if(!myInputPane->check() || !GetScalarPane()->check())
     return 0;
   
   int anIsOk = myInputPane->storeToPrsObject( myPrsCopy );
-  anIsOk &= myScalarPane->storeToPrsObject( myPrsCopy );
+  anIsOk &= GetScalarPane()->storeToPrsObject( myPrsCopy );
   anIsOk &= myIsoPane->storeToPrsObject( myPrsCopy );
 
   VISU::TSameAsFactory<VISU::TISOSURFACES>().Copy(myPrsCopy, thePrs);
@@ -266,37 +223,7 @@ int VisuGUI_IsoSurfacesDlg::storeToPrsObject(VISU::ColoredPrs3d_i* thePrs)
   return anIsOk;
 }
 
-void VisuGUI_IsoSurfacesDlg::onHelp()
+QString VisuGUI_IsoSurfacesDlg::GetContextHelpFilePath()
 {
-  QString aHelpFileName = "/files/iso_surfaces_presentation.htm";
-  LightApp_Application* app = (LightApp_Application*)(SUIT_Session::session()->activeApplication());
-  if (app) {
-    VisuGUI* aVisuGUI = dynamic_cast<VisuGUI*>( app->activeModule() );
-    app->onHelpContextModule(aVisuGUI ? app->moduleName(aVisuGUI->moduleName()) : QString(""), aHelpFileName);
-  }
-  else {
-               QString platform;
-#ifdef WIN32
-               platform = "winapplication";
-#else
-               platform = "application";
-#endif
-    SUIT_MessageBox::warn1(0, QObject::tr("WRN_WARNING"),
-                          QObject::tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
-                          arg(app->resourceMgr()->stringValue("ExternalBrowser", platform)).arg(aHelpFileName),
-                          QObject::tr("BUT_OK"));
-  }
-}
-
-void VisuGUI_IsoSurfacesDlg::keyPressEvent( QKeyEvent* e )
-{
-  QDialog::keyPressEvent( e );
-  if ( e->isAccepted() )
-    return;
-
-  if ( e->key() == Key_F1 )
-    {
-      e->accept();
-      onHelp();
-    }
+  return "/files/iso_surfaces_presentation.htm";
 }
index efea4c1e9785b56b0904eb6f829d51bb0691b87e..70ced751572c4894759eda643fb4cc6c37585036 100644 (file)
@@ -53,15 +53,13 @@ class VisuGUI_IsoSurfPane : public QVBox
   Q_OBJECT;
 
  public:
-  VisuGUI_IsoSurfPane (QWidget* parent);
+  VisuGUI_IsoSurfPane (QWidget* parent,
+                      VisuGUI_ScalarBarPane* theScalarPane);
   ~VisuGUI_IsoSurfPane() {};
 
   void initFromPrsObject(VISU::IsoSurfaces_i* thePrs);
   int storeToPrsObject(VISU::IsoSurfaces_i* thePrs);
 
-  void setScalarBarPane(VisuGUI_ScalarBarPane* theScalarPane) {myScalarPane = theScalarPane;}
-  VisuGUI_ScalarBarPane* getScalarBarPane() {return myScalarPane;}
-
   bool check();
 
  protected slots:
@@ -75,7 +73,7 @@ class VisuGUI_IsoSurfPane : public QVBox
 };
 
 
-class VisuGUI_IsoSurfacesDlg : public VisuGUI_Prs3dDlg
+class VisuGUI_IsoSurfacesDlg : public VisuGUI_ScalarBarBaseDlg
 {
   Q_OBJECT;
 
@@ -83,21 +81,20 @@ class VisuGUI_IsoSurfacesDlg : public VisuGUI_Prs3dDlg
   VisuGUI_IsoSurfacesDlg (SalomeApp_Module* theModule);
   ~VisuGUI_IsoSurfacesDlg();
 
-  virtual void initFromPrsObject(VISU::ColoredPrs3d_i* thePrs, bool theInit = true);
+  virtual void initFromPrsObject( VISU::ColoredPrs3d_i* thePrs,
+                                 bool theInit );
+
   virtual int storeToPrsObject(VISU::ColoredPrs3d_i* thePrs);
 
- private:
-  void keyPressEvent( QKeyEvent* e );
+ protected:
+  virtual QString  GetContextHelpFilePath();
 
  protected slots:
   void accept();
-  void reject();
-  void onHelp();
 
  private:
   QTabWidget*            myTabBox;
   VisuGUI_IsoSurfPane*   myIsoPane;
-  VisuGUI_ScalarBarPane* myScalarPane;
   VisuGUI_InputPane*     myInputPane;
 
   SALOME::GenericObjPtr<VISU::IsoSurfaces_i> myPrsCopy;
index ead3d4afe8deb8d603e49ecf7ed0c3fb381b77e5..1ca0edcabf61d39d61be4d032765b40f380b43b4 100644 (file)
@@ -550,7 +550,7 @@ void VisuGUI_Plot3DPane::setPlane(int theOrientation, double theXRotation, doubl
 //purpose  :
 //=======================================================================
 VisuGUI_Plot3DDlg::VisuGUI_Plot3DDlg (SalomeApp_Module* theModule)
-  : VisuGUI_Prs3dDlg(theModule)
+  : VisuGUI_ScalarBarBaseDlg(theModule)
 {
   setCaption(tr("TITLE"));
   setSizeGripEnabled(TRUE);
@@ -563,10 +563,8 @@ VisuGUI_Plot3DDlg::VisuGUI_Plot3DDlg (SalomeApp_Module* theModule)
   myIsoPane = new VisuGUI_Plot3DPane (this);
   myIsoPane->setMargin(5);
   myTabBox->addTab(myIsoPane, tr("PLOT3D_TAB_TITLE"));
-  myScalarPane = new VisuGUI_ScalarBarPane (this, false);
-  myScalarPane->setMargin(5);
   myInputPane = new VisuGUI_InputPane(VISU::TPLOT3D, theModule, this);
-  myTabBox->addTab(myScalarPane, tr("SCALAR_BAR_TAB_TITLE"));
+  myTabBox->addTab(GetScalarPane(), tr("SCALAR_BAR_TAB_TITLE"));
   myTabBox->addTab(myInputPane, tr("INPUT_TAB_TITLE"));
 
   TopLayout->addWidget(myTabBox);
@@ -610,11 +608,8 @@ VisuGUI_Plot3DDlg::~VisuGUI_Plot3DDlg()
 //=======================================================================
 void VisuGUI_Plot3DDlg::accept()
 {
-  if (myIsoPane->check() && myScalarPane->check())
-    {
-      myScalarPane->deletePreview();
-      QDialog::accept();
-    }
+  if (myIsoPane->check() && GetScalarPane()->check())
+    VisuGUI_ScalarBarBaseDlg::accept();
 }
 
 //=======================================================================
@@ -623,22 +618,21 @@ void VisuGUI_Plot3DDlg::accept()
 //=======================================================================
 void VisuGUI_Plot3DDlg::reject()
 {
-  myIsoPane->check(); // hide preview
-  myScalarPane->deletePreview();
-  
-  QDialog::reject();
+  VisuGUI_ScalarBarBaseDlg::reject();
 }
 
 //=======================================================================
 //function : initFromPrsObject
 //purpose  :
 //=======================================================================
-void VisuGUI_Plot3DDlg::initFromPrsObject(VISU::ColoredPrs3d_i* thePrs, bool theInit)
+void VisuGUI_Plot3DDlg::initFromPrsObject( VISU::ColoredPrs3d_i* thePrs,
+                                          bool theInit )
 {
   if( theInit )
     myPrsCopy = VISU::TSameAsFactory<VISU::TPLOT3D>().Create(thePrs, VISU::ColoredPrs3d_i::EDoNotPublish);
 
-  myScalarPane->initFromPrsObject(myPrsCopy);
+  VisuGUI_ScalarBarBaseDlg::initFromPrsObject(myPrsCopy, theInit);
+
   myIsoPane->initFromPrsObject(myPrsCopy);
 
   if( !theInit )
@@ -654,11 +648,11 @@ void VisuGUI_Plot3DDlg::initFromPrsObject(VISU::ColoredPrs3d_i* thePrs, bool the
 //=======================================================================
 int VisuGUI_Plot3DDlg::storeToPrsObject (VISU::ColoredPrs3d_i* thePrs)
 { 
-  if(!myInputPane->check() || !myScalarPane->check())
+  if(!myInputPane->check() || !GetScalarPane()->check())
     return 0;
   
   int anIsOk = myInputPane->storeToPrsObject( myPrsCopy );
-  anIsOk &= myScalarPane->storeToPrsObject( myPrsCopy );
+  anIsOk &= GetScalarPane()->storeToPrsObject( myPrsCopy );
   anIsOk &= myIsoPane->storeToPrsObject( myPrsCopy );
 
   VISU::TSameAsFactory<VISU::TPLOT3D>().Copy(myPrsCopy, thePrs);
@@ -670,26 +664,9 @@ int VisuGUI_Plot3DDlg::storeToPrsObject (VISU::ColoredPrs3d_i* thePrs)
 //function : onHelp
 //purpose  :
 //=======================================================================
-void VisuGUI_Plot3DDlg::onHelp()
+QString VisuGUI_Plot3DDlg::GetContextHelpFilePath()
 {
-  QString aHelpFileName = "plot_3d_presentation.htm";
-  LightApp_Application* app = (LightApp_Application*)(SUIT_Session::session()->activeApplication());
-  if (app) {
-    VisuGUI* aVisuGUI = dynamic_cast<VisuGUI*>( app->activeModule() );
-    app->onHelpContextModule(aVisuGUI ? app->moduleName(aVisuGUI->moduleName()) : QString(""), aHelpFileName);
-  }
-  else {
-               QString platform;
-#ifdef WIN32
-               platform = "winapplication";
-#else
-               platform = "application";
-#endif
-    SUIT_MessageBox::warn1(0, QObject::tr("WRN_WARNING"),
-                          QObject::tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
-                          arg(app->resourceMgr()->stringValue("ExternalBrowser", platform)).arg(aHelpFileName),
-                          QObject::tr("BUT_OK"));
-  }
+  return "plot_3d_presentation.htm";
 }
 
 //=======================================================================
@@ -700,20 +677,3 @@ void VisuGUI_Plot3DDlg::setPlane(int theOrientation, double theXRotation, double
 {
   myIsoPane->setPlane(theOrientation, theXRotation, theYRotation, thePlanePos);
 }
-
-//=================================================================================
-// function : keyPressEvent()
-// purpose  :
-//=================================================================================
-void VisuGUI_Plot3DDlg::keyPressEvent( QKeyEvent* e )
-{
-  QDialog::keyPressEvent( e );
-  if ( e->isAccepted() )
-    return;
-
-  if ( e->key() == Key_F1 )
-    {
-      e->accept();
-      onHelp();
-    }
-}
index baee658903e65d2ac6d4ca8a4064707c56ce6843..8a8d2876367142589f140816d8aef7d3fb921fc3 100644 (file)
@@ -96,7 +96,7 @@ class VisuGUI_Plot3DPane : public QVBox
 };
 
 
-class VisuGUI_Plot3DDlg : public VisuGUI_Prs3dDlg
+class VisuGUI_Plot3DDlg : public VisuGUI_ScalarBarBaseDlg
 {
   Q_OBJECT
 
@@ -104,23 +104,23 @@ class VisuGUI_Plot3DDlg : public VisuGUI_Prs3dDlg
   VisuGUI_Plot3DDlg (SalomeApp_Module* theModule);
   ~VisuGUI_Plot3DDlg();
 
-  virtual void initFromPrsObject(VISU::ColoredPrs3d_i* thePrs, bool theInit = true);
+  virtual void initFromPrsObject( VISU::ColoredPrs3d_i* thePrs,
+                                 bool theInit );
+
   virtual int  storeToPrsObject(VISU::ColoredPrs3d_i* thePrs);
 
   void setPlane(int theOrientation, double theXRotation, double theYRotation, double thePlanePos);
 
- private:
-  void keyPressEvent( QKeyEvent* e );
-
+ protected:
+  virtual QString GetContextHelpFilePath();
  protected slots:
   void accept();
   void reject();
-  void onHelp();
 
  private:
   QTabWidget*            myTabBox;
   VisuGUI_Plot3DPane*    myIsoPane;
-  VisuGUI_ScalarBarPane* myScalarPane;
   VisuGUI_InputPane*     myInputPane;
 
   SALOME::GenericObjPtr<VISU::Plot3D_i> myPrsCopy;
index 6fcd97efd8e66e251b2b86430a5302a7d9feaad8..3eb42d6df7b2ad52659e4c68ef5364ea7498215a 100644 (file)
@@ -75,7 +75,6 @@ using namespace std;
 //-----------------------------------------------------------------------
 // Text Preferences Dialog
 //-----------------------------------------------------------------------
-
 /*!
   Constructor
 */
@@ -144,16 +143,22 @@ VisuGUI_TextPrefDlg::VisuGUI_TextPrefDlg (QWidget* parent)
   connect(buttonHelp,   SIGNAL(clicked()), this, SLOT(onHelp()));
 }
 
+
+//----------------------------------------------------------------------------
 QString VisuGUI_TextPrefDlg::getTitleText()
 {
   return myTitleEdt->text();
 }
 
+
+//----------------------------------------------------------------------------
 void VisuGUI_TextPrefDlg::setTitleText(QString theText)
 {
   myTitleEdt->setText(theText);
 }
 
+
+//----------------------------------------------------------------------------
 void VisuGUI_TextPrefDlg::setTitleVisible(bool isVisible)
 {
   if(isVisible)
@@ -162,6 +167,8 @@ void VisuGUI_TextPrefDlg::setTitleVisible(bool isVisible)
     myTitleEdt->hide();
 }
 
+
+//----------------------------------------------------------------------------
 void VisuGUI_TextPrefDlg::onHelp()
 {
   QString aHelpFileName = "/files/scalar_map_presentation.htm";
@@ -178,6 +185,8 @@ void VisuGUI_TextPrefDlg::onHelp()
   }
 }
 
+
+//----------------------------------------------------------------------------
 void VisuGUI_TextPrefDlg::storeBeginValues()
 {
   myTitle = myTitleEdt->text();
@@ -185,6 +194,8 @@ void VisuGUI_TextPrefDlg::storeBeginValues()
   myLabelFont->GetData(myColors[1], myComboVals[1], myCheckVals[3], myCheckVals[4], myCheckVals[5]);
 }
 
+
+//----------------------------------------------------------------------------
 /*!
   Called when <Cancel> button is clicked, restore begin values
 */
@@ -196,6 +207,9 @@ void VisuGUI_TextPrefDlg::reject()
 
   QDialog::reject();
 }
+
+
+//----------------------------------------------------------------------------
 /*!
   Called when <Ok> button is clicked, store begin values
 */
@@ -206,6 +220,8 @@ void VisuGUI_TextPrefDlg::accept()
   QDialog::accept();
 }
 
+
+//----------------------------------------------------------------------------
 /*!
   Provides help on F1 button click
 */
@@ -225,12 +241,14 @@ void VisuGUI_TextPrefDlg::keyPressEvent( QKeyEvent* e )
 //-----------------------------------------------------------------------
 // Scalar Bar Pane
 //-----------------------------------------------------------------------
-
 /*!
   Constructor
 */
-VisuGUI_ScalarBarPane::VisuGUI_ScalarBarPane (QWidget * parent, bool SetPref):
-  QVBox(parent), myPreviewActor(0)
+VisuGUI_ScalarBarPane::VisuGUI_ScalarBarPane (QWidget * parent):
+  QVBox(parent), 
+  myPreviewActor(0),
+  myScalarMap(NULL),
+  myScalarMapPL(NULL)
 {
   SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr();
   QString propertyName;
@@ -246,9 +264,6 @@ VisuGUI_ScalarBarPane::VisuGUI_ScalarBarPane (QWidget * parent, bool SetPref):
   myHorW = aResourceMgr->doubleValue("VISU", propertyName + "width", 0.);
   myHorH = aResourceMgr->doubleValue("VISU", propertyName + "height",0.);
   
-  Imin = 0.0; Imax = 0.0; /*Fmin = 0.0; Fmax = 0.0;*/ Rmin = 0.0; Rmax = 0.0;
-  myRangeMode = -1;
-
   setSpacing(6);
   //setMargin(11);
 
@@ -408,16 +423,9 @@ VisuGUI_ScalarBarPane::VisuGUI_ScalarBarPane (QWidget * parent, bool SetPref):
 
   // Save check box ===========================================================
   QHBox* aSaveBox = new QHBox(this);
-  if (!SetPref) {
-    CBSave = new QCheckBox (tr("SAVE_DEFAULT_CHK"), aSaveBox, "CBSave");
-    //TopLayout->addWidget(CBSave);
-  }
-  else {
-    CBSave = 0;
-  }
   myTextBtn = new QPushButton("Text properties...", aSaveBox);
   myTextDlg = new VisuGUI_TextPrefDlg(this);
-  myTextDlg->setTitleVisible(!SetPref);
+  myTextDlg->setTitleVisible(TRUE);
 
   QGroupBox* CheckGroup = new QGroupBox("", this, "CheckGroup");
   CheckGroup->setColumnLayout(0, Qt::Vertical );
@@ -448,288 +456,27 @@ VisuGUI_ScalarBarPane::VisuGUI_ScalarBarPane (QWidget * parent, bool SetPref):
   myBusy = false;
 }
 
-/**
- * Initializes dialog box values from resources
- */
-void VisuGUI_ScalarBarPane::initFromResources() {
-  int sbCol=64,sbLab=5,orient=0;
-  float sbX1=0.01,sbY1=0.1,sbW=0.1,sbH=0.8;
-  float sbVmin=0., sbVmax=0.;
-  bool sbRange=false;
-  QString aString;
-
-  SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr();
-
-  bool anIsArrangeBar = aResourceMgr->booleanValue("VISU", "scalar_bars_default_position", 0);
-  int aPlace = 1;
-  if (anIsArrangeBar){
-    aPlace = aResourceMgr->integerValue("VISU", "scalar_bar_position_num",0);
-  }
-
-  int aScalarMode = aResourceMgr->integerValue("VISU", "scalar_bar_mode", 0);
-  myModeCombo->setCurrentItem(aScalarMode);
-
-  orient = aResourceMgr->integerValue("VISU", "scalar_bar_orientation", orient);
-  if(orient != 0){
-    orient=1;
-    sbX1=0.2;
-    sbY1=0.01;
-    sbW=0.6;
-    sbH=0.12;
-  }
-  
-  QString propertyName = QString( "scalar_bar_%1_" ).arg( orient == 0 ? "vertical" : "horizontal" );
-
-  sbX1 = aResourceMgr->doubleValue("VISU", propertyName + "x", sbX1);
-  sbY1 = aResourceMgr->doubleValue("VISU", propertyName + "y", sbY1);
-
-  sbW = aResourceMgr->doubleValue("VISU", propertyName + "width", sbW);
-  sbH = aResourceMgr->doubleValue("VISU", propertyName + "height",sbH);
-  
-  if(orient){
-    sbY1 += sbH*(aPlace-1);
-  } else {
-    sbX1 += sbW*(aPlace-1);
-  }
-  sbCol = aResourceMgr->integerValue("VISU" ,"scalar_bar_num_colors", sbCol);
-  sbLab = aResourceMgr->integerValue("VISU", "scalar_bar_num_labels", sbLab);
-
-  int rangeType = aResourceMgr->integerValue("VISU" , "scalar_range_type", 0);
-  if (rangeType == 1) sbRange = true;
-  sbVmin = aResourceMgr->doubleValue("VISU", "scalar_range_min", sbVmin);
-  sbVmax = aResourceMgr->doubleValue("VISU", "scalar_range_max", sbVmax);
-
-  bool isLog = aResourceMgr->booleanValue("VISU", "scalar_bar_logarithmic", false);
-  setLogarithmic(isLog);
-  
-  if((sbX1 < 0.) || (sbY1 < 0.) ||
-     ((sbX1+sbW) > 1.) || ((sbY1+sbH) > 1.)) {
-    if(orient == 0) {
-      sbX1=0.01;
-      sbY1=0.1;
-      sbW=0.1;
-      sbH=0.8;
-    } else {
-      sbX1=0.2;
-      sbY1=0.01;
-      sbW=0.6;
-      sbH=0.12;
-    }
-  }
-  if(sbCol < 2) sbCol=2;
-  if(sbCol > 64) sbCol=64;
-  if(sbLab < 2) sbLab=2;
-  if(sbLab > 65) sbLab=65;
-
-  if(sbVmin > sbVmax) {
-    sbVmin=0.;
-    sbVmax=0.;
-  }
-
-  setRange( sbVmin, sbVmax, /*0.0, 0.0,*/ sbRange );
-  setPosAndSize( sbX1, sbY1, sbW, sbH, orient == 0);
-  setScalarBarData( sbCol, sbLab );
-
-  // "Title"
-  bool isBold = false, isItalic = false, isShadow = false;
-  int aFontFamily = VTK_ARIAL;
-
-  if ( aResourceMgr->hasValue( "VISU", "scalar_bar_title_font" ) )
-    {
-      QFont f = aResourceMgr->fontValue( "VISU", "scalar_bar_title_font" );
-      
-      if ( f.family() == "Arial" )
-       aFontFamily = VTK_ARIAL;
-      else if ( f.family() == "Courier" )
-       aFontFamily = VTK_COURIER;
-      else if ( f.family() == "Times" )
-       aFontFamily = VTK_TIMES;
-      
-      isBold = f.bold();
-      isItalic = f.italic();
-      isShadow =  f.underline();
-    }
-  
-  QColor aTextColor = aResourceMgr->colorValue( "VISU", "scalar_bar_title_color", QColor( 255, 255, 255 ) );
-  
-  myTextDlg->myTitleFont->SetData(aTextColor, aFontFamily, isBold, isItalic, isShadow);
-
-  // "Labels"
-  isBold = isItalic = isShadow = false;
-  aFontFamily = VTK_ARIAL;
 
-  if ( aResourceMgr->hasValue( "VISU", "scalar_bar_label_font" ) )
-    {
-      QFont f = aResourceMgr->fontValue( "VISU", "scalar_bar_label_font" );
-      
-      if ( f.family() == "Arial" )
-       aFontFamily = VTK_ARIAL;
-      else if ( f.family() == "Courier" )
-       aFontFamily = VTK_COURIER;
-      else if ( f.family() == "Times" )
-       aFontFamily = VTK_TIMES;
-      
-      isBold = f.bold();
-      isItalic = f.italic();
-      isShadow =  f.underline();
-    }
-  
-  aTextColor = aResourceMgr->colorValue( "VISU", "scalar_bar_label_color", QColor( 255, 255, 255 ) );
-  
-  myTextDlg->myLabelFont->SetData(aTextColor, aFontFamily, isBold, isItalic, isShadow);
+//----------------------------------------------------------------------------
+VisuGUI_ScalarBarPane::~VisuGUI_ScalarBarPane()
+{
+  deleteScalarBar();
+  if (SVTK_ViewWindow* aViewWindow = VISU::GetActiveViewWindow<SVTK_ViewWindow>())
+    aViewWindow->Repaint();
 }
 
-/**
- * Stores dialog values to resources
- */
-void VisuGUI_ScalarBarPane::storeToResources() {
-  int orient = (RBvert->isChecked())? 0 : 1;
-  float sbX1   = XSpin->value();
-  float sbY1   = YSpin->value();
-  float sbW    = WidthSpin->value();
-  float sbH    = HeightSpin->value();
-  int sbCol  = ColorSpin->value();
-  int sbLab  = LabelSpin->value();
-
-  if((sbX1 < 0.) || (sbY1 < 0.) || ((sbX1+sbW) > 1.) || ((sbY1+sbH) > 1.)) {
-    if(orient == 0) {
-      sbX1=0.01;
-      sbY1=0.1;
-      sbW=0.17;
-      sbH=0.8;
-    } else {
-      sbX1=0.2;
-      sbY1=0.01;
-      sbW=0.6;
-      sbH=0.12;
-    }
-  }
-
-  bool sbRange = RBIrange->isChecked();
-  float sbVmin = (float)(MinEdit->text().toDouble());
-  float sbVmax = (float)(MaxEdit->text().toDouble());
-
-  if(sbVmin > sbVmax) {
-    sbVmin=0.;
-    sbVmax=0.;
-  }
-
-  SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr();
-
-  aResourceMgr->setValue("VISU", "scalar_bar_orientation", orient);
-
-  QString propertyName = QString( "scalar_bar_%1_" ).arg( orient == 0 ? "vertical" : "horizontal" );
-
-  aResourceMgr->setValue("VISU", propertyName + "x", sbX1);
-  aResourceMgr->setValue("VISU", propertyName + "y", sbY1);
-  aResourceMgr->setValue("VISU", propertyName + "width", sbW);
-  aResourceMgr->setValue("VISU", propertyName + "height", sbH);
-
-  aResourceMgr->setValue("VISU", "scalar_bar_num_colors", sbCol);
-  aResourceMgr->setValue("VISU", "scalar_bar_num_labels", sbLab);
-
-  if(sbRange)
-    {
-      aResourceMgr->setValue("VISU", "scalar_range_type", 1);
-      aResourceMgr->setValue("VISU", "scalar_range_min" ,sbVmin);
-      aResourceMgr->setValue("VISU", "scalar_range_max" ,sbVmax);
-    }
-  else
-    aResourceMgr->setValue("VISU", "scalar_range_type", 0);
-  
-  aResourceMgr->setValue("VISU", "scalar_bar_logarithmic", isLogarithmic());
-  ////
-
-  if (myIsStoreTextProp) {
-    // "Title"
-    QColor aTitleColor (255, 255, 255);
-    int aTitleFontFamily = VTK_ARIAL;
-    bool isTitleBold = false;
-    bool isTitleItalic = false;
-    bool isTitleShadow = false;
-
-    myTextDlg->myTitleFont->GetData(aTitleColor, aTitleFontFamily,
-                                    isTitleBold, isTitleItalic, isTitleShadow);
-
-    QFont aTitleFont;
-    
-    aTitleFont.setBold(isTitleBold);
-    aTitleFont.setItalic(isTitleItalic);
-    aTitleFont.setUnderline(isTitleShadow);
-    
-    QString titleFontFamily;
-    switch (aTitleFontFamily) {
-    case VTK_ARIAL:
-      titleFontFamily = "Arial";
-      break;
-    case VTK_COURIER:
-      titleFontFamily = "Courier";
-      break;
-    case VTK_TIMES:
-      titleFontFamily = "Times";
-      break;
-    }
-    aTitleFont.setFamily(titleFontFamily);
-    
-    aResourceMgr->setValue("VISU", "scalar_bar_title_font", aTitleFont);
-    
-    aResourceMgr->setValue("VISU", "scalar_bar_title_color", aTitleColor);
-    
-    // "Label"
-    QColor aLabelColor (255, 255, 255);
-    int aLabelFontFamily = VTK_ARIAL;
-    bool isLabelBold = false;
-    bool isLabelItalic = false;
-    bool isLabelShadow = false;
-
-    myTextDlg->myLabelFont->GetData(aLabelColor, aLabelFontFamily,
-                                    isLabelBold, isLabelItalic, isLabelShadow);
-
-
-    QFont aLabelFont;
-    
-    aLabelFont.setBold(isLabelBold);
-    aLabelFont.setItalic(isLabelItalic);
-    aLabelFont.setUnderline(isLabelShadow);
-
-    QString labelFontFamily;
-    switch (aLabelFontFamily) {
-    case VTK_ARIAL:
-      labelFontFamily = "Arial";
-      break;
-    case VTK_COURIER:
-      labelFontFamily = "Courier";
-      break;
-    case VTK_TIMES:
-      labelFontFamily = "Times";
-      break;
-    }
-
-    aLabelFont.setFamily(labelFontFamily);
-    
-    aResourceMgr->setValue("VISU", "scalar_bar_label_font", aLabelFont);
-
-    aResourceMgr->setValue("VISU", "scalar_bar_label_color", aLabelColor);
-  }
-}
 
+//----------------------------------------------------------------------------
 /**
  * Initialise dialog box from presentation object
  */
 void VisuGUI_ScalarBarPane::initFromPrsObject(VISU::ColoredPrs3d_i* thePrs)
 {
-  initFromResources();
   myScalarMap = dynamic_cast<VISU::ScalarMap_i*>(thePrs);
+  
   if( !myScalarMap )
     return;
 
-  myTitle = myScalarMap->GetTitle();
-  setPosAndSize( myScalarMap->GetPosX(),
-                myScalarMap->GetPosY(),
-                myScalarMap->GetWidth(),
-                myScalarMap->GetHeight(),
-                myScalarMap->GetBarOrientation());
   switch(myScalarMap->GetScaling()){
   case VISU::LOGARITHMIC :
     setLogarithmic(true);
@@ -737,11 +484,6 @@ void VisuGUI_ScalarBarPane::initFromPrsObject(VISU::ColoredPrs3d_i* thePrs)
   default:
     setLogarithmic(false);
   }
-  CORBA::Double aRange[2] = {myScalarMap->GetSourceMin(), myScalarMap->GetSourceMax()};
-  Rmin = aRange[0]; Rmax = aRange[1];
-  setRange( myScalarMap->GetMin(), myScalarMap->GetMax(),
-           /*0.0, 0.0,*/ myScalarMap->IsRangeFixed() );
-  setScalarBarData( myScalarMap->GetNbColors(), myScalarMap->GetLabels() );
 
   // Update myModeCombo
   const VISU::PField& aField = myScalarMap->GetScalarField();
@@ -766,21 +508,32 @@ void VisuGUI_ScalarBarPane::initFromPrsObject(VISU::ColoredPrs3d_i* thePrs)
 
     myModeCombo->insertItem(aComponent);
   }
-  //
+
   myModeCombo->setCurrentItem(myScalarMap->GetScalarMode());
-  if (aNbComp==1){
+  if(aNbComp == 1)
     myModeCombo->setCurrentItem(1);
-  }
-  //
+
   myModeLbl->setEnabled(isScalarMode);
   myModeCombo->setEnabled(isScalarMode);
 
+  setRange( myScalarMap->GetMin(), myScalarMap->GetMax(), myScalarMap->IsRangeFixed() );
+
+  setScalarBarData( myScalarMap->GetNbColors(), myScalarMap->GetLabels() );
+
   // "Title"
-  myTextDlg->setTitleText(QString(myScalarMap->GetTitle()));
+  CORBA::String_var aTitle = myScalarMap->GetTitle();
+  myTextDlg->setTitleText(aTitle.in());
+  myTitle = aTitle.in();
 
   vtkFloatingPointType R, G, B;
   myScalarMap->GetTitleColor(&R, &G, &B);
 
+  setPosAndSize( myScalarMap->GetPosX(),
+                myScalarMap->GetPosY(),
+                myScalarMap->GetWidth(),
+                myScalarMap->GetHeight(),
+                myScalarMap->GetBarOrientation());
+
   myTextDlg->myTitleFont->SetData(QColor((int)(R*255.), (int)(G*255.), (int)(B*255.)),
                                   myScalarMap->GetTitFontType(),
                                   myScalarMap->IsBoldTitle(),
@@ -803,6 +556,9 @@ void VisuGUI_ScalarBarPane::initFromPrsObject(VISU::ColoredPrs3d_i* thePrs)
   }
 
 }
+
+
+//----------------------------------------------------------------------------
 /*! Slot update preview of scalar bar, if preview is checked
  */
 void VisuGUI_ScalarBarPane::updatePreview()
@@ -816,6 +572,8 @@ void VisuGUI_ScalarBarPane::updatePreview()
   }
 }
 
+
+//----------------------------------------------------------------------------
 /*! Creating preview scalar bar
  */
 void VisuGUI_ScalarBarPane::createScalarBar()
@@ -912,6 +670,9 @@ void VisuGUI_ScalarBarPane::createScalarBar()
 
   myBusy = false;
 }
+
+
+//----------------------------------------------------------------------------
 /*! Deleting preview scalar bar
  */
 void VisuGUI_ScalarBarPane::deleteScalarBar()
@@ -932,14 +693,9 @@ void VisuGUI_ScalarBarPane::deleteScalarBar()
     myScalarMapPL = 0;
   }
 }
-/*! public: Deleting preview scalar bar
- */
-void VisuGUI_ScalarBarPane::deletePreview()
-{
-  deleteScalarBar();
-  if (SVTK_ViewWindow* vf = VISU::GetActiveViewWindow<SVTK_ViewWindow>())
-    vf->Repaint();
-}
+
+
+//----------------------------------------------------------------------------
 /**
  * Store values to presentation object
  */
@@ -964,8 +720,6 @@ int VisuGUI_ScalarBarPane::storeToPrsObject(VISU::ColoredPrs3d_i* thePrs) {
   myScalarMap->SetNbColors(ColorSpin->value());
   myScalarMap->SetLabels(LabelSpin->value());
 
-  if (isToSave()) storeToResources();
-
   if (myIsStoreTextProp) {
     // "Title"
     myScalarMap->SetTitle(myTextDlg->getTitleText().latin1());
@@ -1010,6 +764,8 @@ int VisuGUI_ScalarBarPane::storeToPrsObject(VISU::ColoredPrs3d_i* thePrs) {
   return 1;
 }
 
+
+//----------------------------------------------------------------------------
 /*!
   Called when orientation is changed
 */
@@ -1030,44 +786,26 @@ void VisuGUI_ScalarBarPane::changeDefaults( int )
   updatePreview();
 }
 
+
+//----------------------------------------------------------------------------
 /*!
   Called when Range mode is changed
 */
 void VisuGUI_ScalarBarPane::changeRange( int )
 {
-  int mode = -1;
-  if ( RBFrange->isChecked() )
-    mode = 0;
-  if ( RBIrange->isChecked() )
-    mode = 1;
-  if ( myRangeMode == mode )
-    return;
-  //MinSpin->setMaxValue( Fmin );
-  //MaxSpin->setMinValue( Fmax );
   if ( RBFrange->isChecked() ) {
-    //MinLabel->setEnabled( false );
     MinEdit->setEnabled( false );
-    //MaxLabel->setEnabled( false );
     MaxEdit->setEnabled( false );
-    if ( mode != -1 ) {
-      Imin = MinEdit->text().toDouble();
-      Imax = MaxEdit->text().toDouble();
-    }
-    MinEdit->setText( QString::number( Rmin ) );
-    MaxEdit->setText( QString::number( Rmax ) );
-  }
-  else {
-    //MinLabel->setEnabled( true );
+  } else {
     MinEdit->setEnabled( true );
-    //MaxLabel->setEnabled( true );
     MaxEdit->setEnabled( true );
-    MinEdit->setText( QString::number( Imin ) );
-    MaxEdit->setText( QString::number( Imax ) );
   }
-  myRangeMode = mode;
-  updatePreview();
+
+  changeScalarMode(myModeCombo->currentItem());
 }
 
+
+//----------------------------------------------------------------------------
 /*!
   Called when X,Y position is changed
 */
@@ -1083,6 +821,8 @@ void VisuGUI_ScalarBarPane::XYChanged( double )
   updatePreview();
 }
 
+
+//----------------------------------------------------------------------------
 /*!
   Called when scalar mode is changed
 */
@@ -1090,47 +830,33 @@ void VisuGUI_ScalarBarPane::changeScalarMode( int theMode )
 {
   if ( myScalarMap ) {
     if ( RBFrange->isChecked() ) {
-      int aMode = myScalarMap->GetScalarMode();
-      myScalarMap->SetScalarMode(theMode);
-      CORBA::Double aRange[2] = {myScalarMap->GetSourceMin(), myScalarMap->GetSourceMax()};
-      MinEdit->setText( QString::number( aRange[0] ) );
-      MaxEdit->setText( QString::number( aRange[1] ) );
-      myScalarMap->SetScalarMode(aMode);
+      MinEdit->setText( QString::number( myScalarMap->GetComponentMin(theMode) ) );
+      MaxEdit->setText( QString::number( myScalarMap->GetComponentMax(theMode) ) );
     }
   }
   updatePreview();
 }
 
+
+//----------------------------------------------------------------------------
 /*!
   Sets default values and range mode
 */
-void VisuGUI_ScalarBarPane::setRange( double imin, double imax/*, double fmin, double fmax*/, bool sbRange )
+void VisuGUI_ScalarBarPane::setRange( double imin, double imax, bool sbRange )
 {
-  Imin = imin; Imax = imax;// Fmin = fmin; Fmax = fmax;
-  if ( RBIrange->isChecked() ) {
-    MinEdit->setText( QString::number( Imin ) );
-    MaxEdit->setText( QString::number( Imax ) );
-  }
-  else {
-    MinEdit->setText( QString::number( Rmin ) );
-    MaxEdit->setText( QString::number( Rmax ) );
-  }
-  myRangeMode = -1;
+  MinEdit->setText( QString::number( imin ) );
+  MaxEdit->setText( QString::number( imax ) );
+
   if( sbRange )
     RBIrange->setChecked( true );
   else
     RBFrange->setChecked( true );
+
   changeRange( 0 );
 }
 
-/*!
-  Sets default values and range mode
-*/
-void VisuGUI_ScalarBarPane::setDefaultRange(double imin, double imax){
-  Rmin = imin;
-  Rmax = imax;
-}
 
+//----------------------------------------------------------------------------
 /*!
   Sets and gets parameters
 */
@@ -1138,50 +864,68 @@ bool VisuGUI_ScalarBarPane::isIRange() {
   return RBIrange->isChecked();
 }
 
+
+//----------------------------------------------------------------------------
 double VisuGUI_ScalarBarPane::getMin() {
   return MinEdit->text().toDouble();
 }
 
+
+//----------------------------------------------------------------------------
 double VisuGUI_ScalarBarPane::getMax() {
   return MaxEdit->text().toDouble();
 }
 
+
+//----------------------------------------------------------------------------
 double VisuGUI_ScalarBarPane::getX() {
   return XSpin->value();
 }
 
+
+//----------------------------------------------------------------------------
 double VisuGUI_ScalarBarPane::getY() {
   return YSpin->value();
 }
 
+
+//----------------------------------------------------------------------------
 double VisuGUI_ScalarBarPane::getWidth() {
   return WidthSpin->value();
 }
 
+
+//----------------------------------------------------------------------------
 double VisuGUI_ScalarBarPane::getHeight() {
   return HeightSpin->value();
 }
 
+
+//----------------------------------------------------------------------------
 int VisuGUI_ScalarBarPane::getNbColors() {
   return ColorSpin->value();
 }
 
+
+//----------------------------------------------------------------------------
 int VisuGUI_ScalarBarPane::getNbLabels() {
   return LabelSpin->value();
 }
 
+
+//----------------------------------------------------------------------------
 bool VisuGUI_ScalarBarPane::isLogarithmic() {
   return CBLog->isChecked();
 }
 
+
+//----------------------------------------------------------------------------
 void VisuGUI_ScalarBarPane::setLogarithmic( bool on ) {
   CBLog->setChecked( on );
 }
 
-bool VisuGUI_ScalarBarPane::isToSave() {
-  return CBSave ? CBSave->isChecked() : false;
-}
 
+//----------------------------------------------------------------------------
 /*!
   Sets size and position
 */
@@ -1204,6 +948,8 @@ void VisuGUI_ScalarBarPane::setPosAndSize( double x, double y, double w, double
   changeDefaults( 0 );
 }
 
+
+//----------------------------------------------------------------------------
 /*!
   Sets colors and labels number
 */
@@ -1213,6 +959,8 @@ void VisuGUI_ScalarBarPane::setScalarBarData( int colors, int labels )
   LabelSpin->setValue( labels );
 }
 
+
+//----------------------------------------------------------------------------
 /*!
   Gets orientation
 */
@@ -1224,6 +972,8 @@ int  VisuGUI_ScalarBarPane::getOrientation()
     return 0;
 }
 
+
+//----------------------------------------------------------------------------
 /*!
   Called when <OK> button is clicked, validates data and closes dialog
 */
@@ -1239,40 +989,31 @@ bool VisuGUI_ScalarBarPane::check()
       return false;
     }
   }
+
   // check if logarithmic mode is on and check imposed range to not contain negative values
   if ( CBLog->isChecked() ) {
-    if ( RBIrange->isChecked() ) {
-      if ( (minVal > 0) && (maxVal > 0) ) {
-       // nothing to do
-      }
-      else {
+    if ( minVal <= 0.0 || maxVal <= 0.0 ) {
+      if ( RBIrange->isChecked() ) {
        SUIT_MessageBox::warn1( this,
-                               tr("WRN_VISU"),
-                               tr("WRN_LOGARITHMIC_RANGE"),
-                               tr("BUT_OK"));
-       return false;
-      }
-    }
-    else {
-      if ( Rmin > 0 && Rmax > 0 ) {
-       // nothing to do
-      }
-      else {
+                               tr("WRN_VISU"),
+                               tr("WRN_LOGARITHMIC_RANGE"),
+                               tr("BUT_OK"));
+      } else {
        SUIT_MessageBox::warn1( this,
-                               tr("WRN_VISU"),
-                               tr("WRN_LOGARITHMIC_FIELD_RANGE"),
-                               tr("BUT_OK"));
-       RBIrange->setChecked(1);
+                               tr("WRN_VISU"),
+                               tr("WRN_LOGARITHMIC_FIELD_RANGE"),
+                               tr("BUT_OK"));
+       RBIrange->setChecked(true);
        changeRange(1);
-       //MinEdit->setText( QString::number( Rmin ) );
-       //MaxEdit->setText( QString::number( Rmax ) );
-       return false;
       }
+      return false;
     }
   }
   return true;
 }
 
+
+//----------------------------------------------------------------------------
 void VisuGUI_ScalarBarPane::onTextPref()
 {
   myTextDlg->storeBeginValues();
@@ -1280,6 +1021,8 @@ void VisuGUI_ScalarBarPane::onTextPref()
   updatePreview();
 }
 
+
+//----------------------------------------------------------------------------
 void VisuGUI_ScalarBarPane::onPreviewCheck (bool thePreview)
 {
   if (SVTK_ViewWindow* vf = VISU::GetActiveViewWindow<SVTK_ViewWindow>()) {
@@ -1292,17 +1035,98 @@ void VisuGUI_ScalarBarPane::onPreviewCheck (bool thePreview)
   }
 }
 
-VisuGUI_Prs3dDlg::VisuGUI_Prs3dDlg( SalomeApp_Module* theModule )
-  : QDialog( VISU::GetDesktop( theModule ), 0, false,
-            WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
+
+//----------------------------------------------------------------------------
+VisuGUI_Prs3dDlg::VisuGUI_Prs3dDlg( SalomeApp_Module* theModule ) :
+  QDialog( VISU::GetDesktop( theModule ), 0, false,
+          WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
+{}
+
+
+//----------------------------------------------------------------------------
+/*!
+  Called when <Help> button is clicked, shows the corresponding help page in defined browser
+*/
+void VisuGUI_Prs3dDlg::onHelp()
 {
+  QString aHelpFileName = GetContextHelpFilePath();
+  LightApp_Application* app = (LightApp_Application*)(SUIT_Session::session()->activeApplication());
+  if (app) {
+    VisuGUI* aVisuGUI = dynamic_cast<VisuGUI*>( app->activeModule() );
+    app->onHelpContextModule(aVisuGUI ? app->moduleName(aVisuGUI->moduleName()) : QString(""), aHelpFileName);
+  }
+  else {
+    SUIT_MessageBox::warn1(0, QObject::tr("WRN_WARNING"),
+                          QObject::tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
+                          arg(app->resourceMgr()->stringValue("ExternalBrowser", "application")).arg(aHelpFileName),
+                          QObject::tr("BUT_OK"));
+  }
 }
 
-void VisuGUI_Prs3dDlg::initFromPrsObject( VISU::ColoredPrs3d_i* thePrs, bool theInit )
+
+//----------------------------------------------------------------------------
+void VisuGUI_Prs3dDlg::keyPressEvent( QKeyEvent* e )
 {
+  QDialog::keyPressEvent( e );
+  if ( e->isAccepted() )
+    return;
+  
+  if ( e->key() == Key_F1 ) {
+    e->accept();
+    onHelp();
+  }
 }
 
-int VisuGUI_Prs3dDlg::storeToPrsObject( VISU::ColoredPrs3d_i* thePrs )
+
+//----------------------------------------------------------------------------
+VisuGUI_ScalarBarBaseDlg::VisuGUI_ScalarBarBaseDlg( SalomeApp_Module* theModule ) :
+  VisuGUI_Prs3dDlg( theModule )
+{
+  myScalarPane = new VisuGUI_ScalarBarPane(this);
+  myScalarPane->setMargin( 5 );
+}
+
+
+VisuGUI_ScalarBarBaseDlg::~VisuGUI_ScalarBarBaseDlg()
 {
-  return 1;
 }
+
+
+
+//----------------------------------------------------------------------------
+void VisuGUI_ScalarBarBaseDlg::initFromPrsObject( VISU::ColoredPrs3d_i* thePrs,
+                                                 bool theInit )
+{
+  myScalarPane->initFromPrsObject( thePrs );
+}
+
+
+//----------------------------------------------------------------------------
+/*!
+  Called when <OK> button is clicked, validates data and closes dialog
+*/
+void VisuGUI_ScalarBarBaseDlg::accept()
+{
+  if (GetScalarPane()->check())
+    VisuGUI_Prs3dDlg::accept();
+}
+
+
+//----------------------------------------------------------------------------
+/*!
+  Called when <Cancel> button is clicked, remove preview and closes dialog
+*/
+void VisuGUI_ScalarBarBaseDlg::reject()
+{
+  VisuGUI_Prs3dDlg::reject();
+}
+
+
+//----------------------------------------------------------------------------
+VisuGUI_ScalarBarPane* VisuGUI_ScalarBarBaseDlg::GetScalarPane()
+{
+  return myScalarPane;
+}
+
+
+//----------------------------------------------------------------------------
index 5f6541f78f2e5c839e0e5bd40dd81ddd8233d4eb..13c589b6312ab015bb3be398a77f3396d294d9f5 100644 (file)
@@ -32,6 +32,7 @@
 #include <qvbox.h>
 
 #include "SALOME_GenericObjPointer.hh"
+#include "VISU_ColoredPrs3d_i.hh"
 
 class QButtonGroup;
 class QGroupBox;
@@ -58,6 +59,8 @@ namespace VISU
   class ScalarMap_i;
 }
 
+
+//----------------------------------------------------------------------------
 class VisuGUI_TextPrefDlg: public QDialog
 {
   Q_OBJECT;
@@ -94,15 +97,16 @@ class VisuGUI_TextPrefDlg: public QDialog
 };
 
 
+//----------------------------------------------------------------------------
 class VisuGUI_ScalarBarPane : public QVBox
 {
   Q_OBJECT;
 
  public:
-  VisuGUI_ScalarBarPane(QWidget* parent, bool SetPref);
-  ~VisuGUI_ScalarBarPane() {};
+  VisuGUI_ScalarBarPane(QWidget* parent);
+  ~VisuGUI_ScalarBarPane();
 
-  void    setRange( double imin, double imax, /*double fmin, double fmax,*/ bool sbRange );
+  void    setRange( double imin, double imax, bool sbRange );
   void    setDefaultRange(double imin, double imax);
   int     getOrientation();
   void    setPosAndSize( double x, double y, double w, double h, bool vert );
@@ -118,16 +122,12 @@ class VisuGUI_ScalarBarPane : public QVBox
   int     getNbLabels();
   bool    isLogarithmic();
   void    setLogarithmic( bool on );
-  bool    isToSave();
-
-  void initFromResources();
-  void storeToResources();
 
   void initFromPrsObject(VISU::ColoredPrs3d_i* thePrs);
+
   int storeToPrsObject(VISU::ColoredPrs3d_i* thePrs);
 
   bool check();
-  void deletePreview();
 
  protected:
   QButtonGroup*   RangeGroup;
@@ -148,18 +148,15 @@ class VisuGUI_ScalarBarPane : public QVBox
   QSpinBox*       ColorSpin;
   QSpinBox*       LabelSpin;
 
-  QCheckBox*      CBSave;
   QCheckBox*      CBLog;
   QLabel*         myModeLbl;
   QComboBox*      myModeCombo;
   QPushButton*    myTextBtn;
   VisuGUI_TextPrefDlg* myTextDlg;
 
-  double          Imin,   Imax,  /* Fmin,   Fmax,*/   Rmin,   Rmax;
   double          myHorX, myHorY, myHorW, myHorH;
   double          myVerX, myVerY, myVerW, myVerH;
-  int             myRangeMode;
-  bool myIsStoreTextProp;
+  bool            myIsStoreTextProp;
 
  private slots:
   void changeDefaults( int );
@@ -183,6 +180,8 @@ class VisuGUI_ScalarBarPane : public QVBox
   bool myBusy;
 };
 
+
+//----------------------------------------------------------------------------
 class VisuGUI_Prs3dDlg : public QDialog
 {
   Q_OBJECT;
@@ -191,8 +190,45 @@ class VisuGUI_Prs3dDlg : public QDialog
   VisuGUI_Prs3dDlg( SalomeApp_Module* theModule );
   ~VisuGUI_Prs3dDlg() {}
 
-  virtual void     initFromPrsObject( VISU::ColoredPrs3d_i* thePrs, bool theInit = true );
-  virtual int      storeToPrsObject( VISU::ColoredPrs3d_i* thePrs );
+  virtual void     initFromPrsObject( VISU::ColoredPrs3d_i* thePrs,
+                                     bool theInit ) = 0;
+
+  virtual int      storeToPrsObject( VISU::ColoredPrs3d_i* thePrs ) = 0;
+
+ protected:
+  virtual QString  GetContextHelpFilePath() = 0;
+
+ protected slots:
+  void onHelp();
+
+ private:
+  void keyPressEvent( QKeyEvent* e );
+};
+
+
+//----------------------------------------------------------------------------
+class VisuGUI_ScalarBarBaseDlg : public VisuGUI_Prs3dDlg
+{
+  Q_OBJECT;
+
+ public:
+  VisuGUI_ScalarBarBaseDlg( SalomeApp_Module* theModule );
+  ~VisuGUI_ScalarBarBaseDlg();
+
+  virtual void     initFromPrsObject( VISU::ColoredPrs3d_i* thePrs,
+                                     bool theInit );
+ protected slots:
+  void accept();
+  void reject();
+
+ protected:
+  VisuGUI_ScalarBarPane* GetScalarPane();
+
+ private:
+  VisuGUI_ScalarBarPane* myScalarPane;
 };
 
+
+//----------------------------------------------------------------------------
+
 #endif
index 2030835de831945febdc0d94e5cdec0634f0a5ea..9ab6a92810c876b3228a6c5952b4ed6589143c18 100644 (file)
@@ -55,7 +55,7 @@ namespace VISU
          isModal = 0;
 
       TDlg* aDlg = new TDlg (theModule);
-      aDlg->initFromPrsObject(aPrs3d);
+      aDlg->initFromPrsObject(aPrs3d, true);
       if (runAndWait(aDlg,isModal)) {
        if (!(aDlg->storeToPrsObject(aPrs3d))) {
          delete aDlg;
@@ -236,7 +236,7 @@ namespace VISU
       
       if (!aValue) {
        if (TDlg* aDlg = new TDlg(theModule)) { // dialog box in creation mode
-         aDlg->initFromPrsObject(aPrs3d);
+         aDlg->initFromPrsObject(aPrs3d, true);
          if (runAndWait(aDlg,IsDlgModal) && (aDlg->storeToPrsObject(aPrs3d))) {
            if(aResourceMgr->booleanValue("VISU","display_only",false)){
              if(SPlot2d_Viewer* aPlot2d = GetPlot2dViewer(theModule, false)) aPlot2d->EraseAll();
index e26a102eb9fcc08478c72ded8cca1a009fb9b802..aa44489d3bbfb0705533320b8719029355288a43 100644 (file)
@@ -64,11 +64,11 @@ using namespace std;
 /*!
   Constructor
 */
-VisuGUI_ScalarBarDlg::VisuGUI_ScalarBarDlg (SalomeApp_Module* theModule, bool SetPref)
-  : VisuGUI_Prs3dDlg(theModule)
+VisuGUI_ScalarBarDlg::VisuGUI_ScalarBarDlg (SalomeApp_Module* theModule)
+  : VisuGUI_ScalarBarBaseDlg(theModule)
 {
   setName("VisuGUI_ScalarBarDlg");
-  setCaption(SetPref ? tr("DLG_PREF_TITLE") : tr("DLG_PROP_TITLE"));
+  setCaption(tr("DLG_PROP_TITLE"));
   setSizeGripEnabled(TRUE);
 
   QVBoxLayout* TopLayout = new QVBoxLayout(this);
@@ -76,10 +76,8 @@ VisuGUI_ScalarBarDlg::VisuGUI_ScalarBarDlg (SalomeApp_Module* theModule, bool Se
   TopLayout->setMargin(11);
 
   myTabBox = new QTabWidget(this);
-  myScalarPane = new VisuGUI_ScalarBarPane(this, SetPref);
-  myScalarPane->setMargin( 5 );
   myInputPane = new VisuGUI_InputPane(VISU::TSCALARMAP, theModule, this);
-  myTabBox->addTab(myScalarPane, "Scalar Bar");
+  myTabBox->addTab(GetScalarPane(), "Scalar Bar");
   myTabBox->addTab(myInputPane, "Input");
 
   TopLayout->addWidget(myTabBox);
@@ -118,56 +116,25 @@ VisuGUI_ScalarBarDlg::VisuGUI_ScalarBarDlg (SalomeApp_Module* theModule, bool Se
 VisuGUI_ScalarBarDlg::~VisuGUI_ScalarBarDlg()
 {}
 
-/*!
-  Called when <OK> button is clicked, validates data and closes dialog
-*/
-void VisuGUI_ScalarBarDlg::accept()
-{
-  if (myScalarPane->check()) 
-    {
-      myScalarPane->deletePreview(); 
-      QDialog::accept();
-    }
-}
-
-/*!
-  Called when <Cancel> button is clicked, remove preview and closes dialog
-*/
-void VisuGUI_ScalarBarDlg::reject()
-{
-  myScalarPane->deletePreview();
-  QDialog::reject();
-}
-
 /*!
   Called when <Help> button is clicked, shows the corresponding help page in defined browser
 */
-void VisuGUI_ScalarBarDlg::onHelp()
+QString VisuGUI_ScalarBarDlg::GetContextHelpFilePath()
 {
-  QString aHelpFileName = "/files/scalar_map_presentation.htm";
-  LightApp_Application* app = (LightApp_Application*)(SUIT_Session::session()->activeApplication());
-  if (app) {
-    VisuGUI* aVisuGUI = dynamic_cast<VisuGUI*>( app->activeModule() );
-    app->onHelpContextModule(aVisuGUI ? app->moduleName(aVisuGUI->moduleName()) : QString(""), aHelpFileName);
-  }
-  else {
-    SUIT_MessageBox::warn1(0, QObject::tr("WRN_WARNING"),
-                          QObject::tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
-                          arg(app->resourceMgr()->stringValue("ExternalBrowser", "application")).arg(aHelpFileName),
-                          QObject::tr("BUT_OK"));
-  }
+  return "/files/scalar_map_presentation.htm";
 }
 
 /*!
   Initialize dialog from the presentation
 */
-void VisuGUI_ScalarBarDlg::initFromPrsObject(VISU::ColoredPrs3d_i* thePrs, bool theInit)
+void VisuGUI_ScalarBarDlg::initFromPrsObject( VISU::ColoredPrs3d_i* thePrs,
+                                             bool theInit )
 {
   if( theInit )
     myPrsCopy = VISU::TSameAsFactory<VISU::TSCALARMAP>().Create(thePrs, VISU::ColoredPrs3d_i::EDoNotPublish);
 
-  myScalarPane->initFromPrsObject( myPrsCopy );
-
+  VisuGUI_ScalarBarBaseDlg::initFromPrsObject(myPrsCopy, theInit);
+  
   if( !theInit )
     return;
 
@@ -180,29 +147,13 @@ void VisuGUI_ScalarBarDlg::initFromPrsObject(VISU::ColoredPrs3d_i* thePrs, bool
 */
 int VisuGUI_ScalarBarDlg::storeToPrsObject(VISU::ColoredPrs3d_i* thePrs)
 {
-  if(!myInputPane->check() || !myScalarPane->check())
+  if(!myInputPane->check() || !GetScalarPane()->check())
     return 0;
   
   int anIsOk = myInputPane->storeToPrsObject( myPrsCopy );
-  anIsOk &= myScalarPane->storeToPrsObject( myPrsCopy );
+  anIsOk &= GetScalarPane()->storeToPrsObject( myPrsCopy );
   
   VISU::TSameAsFactory<VISU::TSCALARMAP>().Copy(myPrsCopy, thePrs);
   
   return anIsOk;
 }
-
-/*!
-  Provides help on F1 button click
-*/
-void VisuGUI_ScalarBarDlg::keyPressEvent( QKeyEvent* e )
-{
-  QDialog::keyPressEvent( e );
-  if ( e->isAccepted() )
-    return;
-
-  if ( e->key() == Key_F1 )
-    {
-      e->accept();
-      onHelp();
-    }
-}
index 761f3d3dbc8eb986dd6451f79bc0cd11bef0228f..378e297090ba09b0eb8bc93b4abc0476f9799035 100644 (file)
@@ -52,32 +52,23 @@ namespace VISU
   class ScalarMap_i;
 }
 
-class VisuGUI_ScalarBarDlg : public VisuGUI_Prs3dDlg
+class VisuGUI_ScalarBarDlg : public VisuGUI_ScalarBarBaseDlg
 {
   Q_OBJECT;
 
  public:
-  VisuGUI_ScalarBarDlg (SalomeApp_Module* theModule, bool SetPref = FALSE);
+  VisuGUI_ScalarBarDlg (SalomeApp_Module* theModule);
   ~VisuGUI_ScalarBarDlg();
 
-  bool isToSave() {return myScalarPane->isToSave();}
+  virtual void initFromPrsObject( VISU::ColoredPrs3d_i* thePrs,
+                                 bool theInit );
 
-  void initFromResources() {myScalarPane->initFromResources();}
-  void storeToResources() {myScalarPane->storeToResources();}
-
-  virtual void initFromPrsObject(VISU::ColoredPrs3d_i* thePrs, bool theInit = true);
   virtual int  storeToPrsObject(VISU::ColoredPrs3d_i* thePrs);
 
- private:
-  void keyPressEvent( QKeyEvent* e );
-
- protected slots:
-  void accept();
-  void reject();
-  void onHelp();
+ protected:
+  virtual QString        GetContextHelpFilePath();
 
  protected:
-  VisuGUI_ScalarBarPane* myScalarPane;
   VisuGUI_InputPane* myInputPane;
   QTabWidget* myTabBox;
 
index d6f303e986b4edc14d49a8dd1fba967d10a7c608..84f9737d081af983a3b33fec0069054f741a431f 100644 (file)
@@ -63,7 +63,7 @@ using namespace std;
  * Constructor
  */
 VisuGUI_ScalarMapOnDeformedShapeDlg::VisuGUI_ScalarMapOnDeformedShapeDlg (SalomeApp_Module* theModule)
-  : VisuGUI_Prs3dDlg(theModule),
+  : VisuGUI_ScalarBarBaseDlg(theModule),
     myIsAnimation(false),
     myUpdateScalars(true),
     myVisuGUI(theModule)
@@ -116,11 +116,9 @@ VisuGUI_ScalarMapOnDeformedShapeDlg::VisuGUI_ScalarMapOnDeformedShapeDlg (Salome
   myTabBox->addTab(aBox, tr("SCALAR_MAP_ON_DEFORMED_SHAPE_TAB"));
 
   // Scalar bar pane
-  myScalarPane = new VisuGUI_ScalarBarPane (this, false);
-  myScalarPane->setMargin(5);
   myInputPane = new VisuGUI_InputPane(VISU::TSCALARMAPONDEFORMEDSHAPE, theModule, this);
 
-  myTabBox->addTab(myScalarPane, tr("SCALAR_BAR_TAB"));
+  myTabBox->addTab(GetScalarPane(), tr("SCALAR_BAR_TAB"));
   myTabBox->addTab(myInputPane, tr("INPUT_TAB"));
 
   // Buttons
@@ -165,20 +163,18 @@ VisuGUI_ScalarMapOnDeformedShapeDlg::VisuGUI_ScalarMapOnDeformedShapeDlg (Salome
 VisuGUI_ScalarMapOnDeformedShapeDlg::~VisuGUI_ScalarMapOnDeformedShapeDlg()
 {}
 
-void VisuGUI_ScalarMapOnDeformedShapeDlg::initFromPrsObject(VISU::ColoredPrs3d_i* thePrs, bool theInit)
+void VisuGUI_ScalarMapOnDeformedShapeDlg::initFromPrsObject( VISU::ColoredPrs3d_i* thePrs,
+                                                            bool theInit )
 {
   if( theInit )
-    myPrsCopy = VISU::TSameAsFactory<VISU::TSCALARMAPONDEFORMEDSHAPE>().Create(thePrs,
-                                                                              VISU::ColoredPrs3d_i::EDoNotPublish);
-
+    myPrsCopy = VISU::TSameAsFactory<VISU::TSCALARMAPONDEFORMEDSHAPE>().Create(thePrs, VISU::ColoredPrs3d_i::EDoNotPublish);
   setFactor(myPrsCopy->GetScale());
   myTimeStampsCombo->setDisabled(myIsAnimation);
-
   
   CORBA::String_var aFieldName(myPrsCopy->GetScalarFieldName());
   QString aIteration = GetFloatValueOfTimeStamp(myPrsCopy->GetScalarEntity(),
-                                             aFieldName.in(),
-                                             myPrsCopy->GetScalarTimeStampNumber());
+                                               aFieldName.in(),
+                                               myPrsCopy->GetScalarTimeStampNumber());
   if (myEntity2Fields.size() == 0)
   {
     // find all fields and time stamps on it
@@ -268,7 +264,7 @@ void VisuGUI_ScalarMapOnDeformedShapeDlg::initFromPrsObject(VISU::ColoredPrs3d_i
   myTimeStampsCombo->setCurrentText(aIteration);
   SetScalarField( false );
 
-  myScalarPane->initFromPrsObject(myPrsCopy);
+  VisuGUI_ScalarBarBaseDlg::initFromPrsObject(myPrsCopy, theInit);
 
   if( !theInit )
     return;
@@ -281,11 +277,11 @@ int
 VisuGUI_ScalarMapOnDeformedShapeDlg
 ::storeToPrsObject(VISU::ColoredPrs3d_i* thePrs)
 {
-  if(!myInputPane->check() || !myScalarPane->check())
+  if(!myInputPane->check() || !GetScalarPane()->check())
     return 0;
   
   int anIsOk = myInputPane->storeToPrsObject( myPrsCopy );
-  anIsOk &= myScalarPane->storeToPrsObject( myPrsCopy );
+  anIsOk &= GetScalarPane()->storeToPrsObject( myPrsCopy );
   
   myPrsCopy->SetScale(getFactor());
 
@@ -344,7 +340,7 @@ VisuGUI_ScalarMapOnDeformedShapeDlg
                 const bool save_scalar_pane )
 {
   if( save_scalar_pane )
-    myScalarPane->storeToPrsObject(myPrsCopy);
+    GetScalarPane()->storeToPrsObject(myPrsCopy);
 
   QString aFieldName;
 
@@ -365,36 +361,17 @@ VisuGUI_ScalarMapOnDeformedShapeDlg
 
 void VisuGUI_ScalarMapOnDeformedShapeDlg::accept()
 {
-  if (myScalarPane->check()){
-    myScalarPane->deletePreview();
-    QDialog::accept();
-  }
+  VisuGUI_ScalarBarBaseDlg::accept();
 }
 
 void VisuGUI_ScalarMapOnDeformedShapeDlg::reject()
 {
-  myScalarPane->deletePreview();
-  QDialog::reject();
+  VisuGUI_ScalarBarBaseDlg::reject();
 }
 
-void VisuGUI_ScalarMapOnDeformedShapeDlg::onHelp()
+QString VisuGUI_ScalarMapOnDeformedShapeDlg::GetContextHelpFilePath()
 {
-  QString aHelpFileName = "scalar_map_on_deformed_shape_presentation.htm";
-  LightApp_Application* app = (LightApp_Application*)(SUIT_Session::session()->activeApplication());
-  if (app)
-    app->onHelpContextModule(myVisuGUI ? app->moduleName(myVisuGUI->moduleName()) : QString(""), aHelpFileName);
-  else {
-               QString platform;
-#ifdef WIN32
-               platform = "winapplication";
-#else
-               platform = "application";
-#endif
-    SUIT_MessageBox::warn1(0, QObject::tr("WRN_WARNING"),
-                          QObject::tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
-                          arg(app->resourceMgr()->stringValue("ExternalBrowser", platform)).arg(aHelpFileName),
-                          QObject::tr("BUT_OK"));
-  }
+  return "scalar_map_on_deformed_shape_presentation.htm";
 }
 
 void VisuGUI_ScalarMapOnDeformedShapeDlg::AddAllFieldNames(){
@@ -448,7 +425,7 @@ void VisuGUI_ScalarMapOnDeformedShapeDlg::onTimeStampChanged(int){
 }
 
 void VisuGUI_ScalarMapOnDeformedShapeDlg::UpdateScalarField(){
-  myScalarPane->initFromPrsObject(myPrsCopy);
+  GetScalarPane()->initFromPrsObject(myPrsCopy);
 }
 
 QString 
@@ -475,16 +452,3 @@ VisuGUI_ScalarMapOnDeformedShapeDlg
   }
   return aTime;
 }
-
-void VisuGUI_ScalarMapOnDeformedShapeDlg::keyPressEvent( QKeyEvent* e )
-{
-  QDialog::keyPressEvent( e );
-  if ( e->isAccepted() )
-    return;
-
-  if ( e->key() == Key_F1 )
-    {
-      e->accept();
-      onHelp();
-    }
-}
index 3ccd052bfd02560aa48c0df26d559ef67db0488b..6974d688df2ad5b4cd55e0f1f23902337f781001 100644 (file)
@@ -53,7 +53,7 @@ namespace VISU
   class ScalarMapOnDeformedShape_i;
 }
 
-class VisuGUI_ScalarMapOnDeformedShapeDlg : public VisuGUI_Prs3dDlg
+class VisuGUI_ScalarMapOnDeformedShapeDlg : public VisuGUI_ScalarBarBaseDlg
 {
     Q_OBJECT
 
@@ -66,7 +66,9 @@ public:
     void setFactor(double theFactor)
       { ScalFact->setValue(theFactor); }
     
-    virtual void initFromPrsObject(VISU::ColoredPrs3d_i* thePrs, bool theInit = true);
+    virtual void initFromPrsObject( VISU::ColoredPrs3d_i* thePrs,
+                                   bool theInit );
+
     virtual int  storeToPrsObject(VISU::ColoredPrs3d_i* thePrs);
 
     int getCurrentScalarFieldNamePos();
@@ -75,13 +77,12 @@ public:
     VISU::Entity getCurrentScalarEntity();
     void SetScalarField(int theIter,QString theFieldName=QString(""), const bool = true );
 
-private:
-    void keyPressEvent( QKeyEvent* e );
+protected:
+  virtual QString GetContextHelpFilePath();
 
 protected slots:
   void accept();
   void reject();
-  void onHelp();
 
 private slots:
   void onFieldChanged(int i=0);
index 8d30b5fe3b23ed914ff436a0f23c4d069f700cf6..d3ecb8756b0835bc794fb1296460270041119edd 100644 (file)
@@ -62,7 +62,7 @@
 using namespace std;
 
 VisuGUI_StreamLinesDlg::VisuGUI_StreamLinesDlg (SalomeApp_Module* theModule)
-  : VisuGUI_Prs3dDlg(theModule),
+  : VisuGUI_ScalarBarBaseDlg(theModule),
     myVisuGUI(theModule)
 {
   setCaption(tr("DLG_TITLE"));
@@ -245,10 +245,8 @@ VisuGUI_StreamLinesDlg::VisuGUI_StreamLinesDlg (SalomeApp_Module* theModule)
   TopLayout->addWidget( SelColor, 5, 1);
 
   myTabBox->addTab(aTopBox, "Stream Lines");
-  myScalarPane = new VisuGUI_ScalarBarPane(this, false);
-  myScalarPane->setMargin( 5 );
   myInputPane = new VisuGUI_InputPane(VISU::TSTREAMLINES, theModule, this);
-  myTabBox->addTab(myScalarPane, "Scalar Bar");
+  myTabBox->addTab(GetScalarPane(), "Scalar Bar");
   myTabBox->addTab(myInputPane, "Input");
 
   aBoxLayout->addWidget(myTabBox);
@@ -289,12 +287,13 @@ VisuGUI_StreamLinesDlg::VisuGUI_StreamLinesDlg (SalomeApp_Module* theModule)
 VisuGUI_StreamLinesDlg::~VisuGUI_StreamLinesDlg()
 {}
 
-void VisuGUI_StreamLinesDlg::initFromPrsObject (VISU::ColoredPrs3d_i* thePrs, bool theInit)
+void VisuGUI_StreamLinesDlg::initFromPrsObject ( VISU::ColoredPrs3d_i* thePrs,
+                                                bool theInit )
 {
   if( theInit )
     myPrsCopy = VISU::TSameAsFactory<VISU::TSTREAMLINES>().Create(thePrs, VISU::ColoredPrs3d_i::EDoNotPublish);
 
-  myScalarPane->initFromPrsObject( myPrsCopy );
+  VisuGUI_ScalarBarBaseDlg::initFromPrsObject(myPrsCopy, theInit);
 
   static int aNbOfSteps = 30;
   VISU_StreamLinesPL* aStreamLinesPL = myPrsCopy->GetSpecificPL();
@@ -369,11 +368,11 @@ void VisuGUI_StreamLinesDlg::initFromPrsObject (VISU::ColoredPrs3d_i* thePrs, bo
 
 int VisuGUI_StreamLinesDlg::storeToPrsObject (VISU::ColoredPrs3d_i* thePrs)
 {
-  if(!myInputPane->check() || !myScalarPane->check())
+  if(!myInputPane->check() || !GetScalarPane()->check())
     return 0;
   
   int anIsOk = myInputPane->storeToPrsObject( myPrsCopy );
-  anIsOk &= myScalarPane->storeToPrsObject( myPrsCopy );
+  anIsOk &= GetScalarPane()->storeToPrsObject( myPrsCopy );
   
   if (anIsOk) {
     myPrsCopy->ShowColored(myUseScalar->isChecked());
@@ -434,10 +433,6 @@ int VisuGUI_StreamLinesDlg::storeToPrsObject (VISU::ColoredPrs3d_i* thePrs)
                                   myPntPercent->value(),
                                   aDirection);
   }
-  //if (!isAccepted)
-  //  SUIT_MessageBox::warn1(VisuGUI::application()->desktop(), tr("WRN_VISU"),
-  //                         tr("ERR_CANT_BUILD_PRESENTATION"),
-  //                         tr("BUT_OK"));
 
   VISU::TSameAsFactory<VISU::TSTREAMLINES>().Copy(myPrsCopy, thePrs);
 
@@ -522,49 +517,17 @@ VISU::Mesh_ptr VisuGUI_StreamLinesDlg::createMesh (VISU::VISUType theType, QStri
   return VISU::Mesh::_nil();
 }
 
-void VisuGUI_StreamLinesDlg::accept() {
-  if (myScalarPane->check())
-    {
-      myScalarPane->deletePreview();
-      QDialog::accept();
-    }
+void VisuGUI_StreamLinesDlg::accept() 
+{
+  VisuGUI_ScalarBarBaseDlg::accept();
 }
 
 void VisuGUI_StreamLinesDlg::reject()
 {
-  myScalarPane->deletePreview();
-  QDialog::reject();
+  VisuGUI_ScalarBarBaseDlg::reject();
 }
 
-void VisuGUI_StreamLinesDlg::onHelp()
+QString VisuGUI_StreamLinesDlg::GetContextHelpFilePath()
 {
-  QString aHelpFileName = "/files/stream_lines_presentation.htm";
-  LightApp_Application* app = (LightApp_Application*)(SUIT_Session::session()->activeApplication());
-  if (app)
-    app->onHelpContextModule(myVisuGUI ? app->moduleName(myVisuGUI->moduleName()) : QString(""), aHelpFileName);
-  else {
-               QString platform;
-#ifdef WIN32
-               platform = "winapplication";
-#else
-               platform = "application";
-#endif
-    SUIT_MessageBox::warn1(0, QObject::tr("WRN_WARNING"),
-                          QObject::tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
-                          arg(app->resourceMgr()->stringValue("ExternalBrowser", platform)).arg(aHelpFileName),
-                          QObject::tr("BUT_OK"));
-  }
-}
-
-void VisuGUI_StreamLinesDlg::keyPressEvent( QKeyEvent* e )
-{
-  QDialog::keyPressEvent( e );
-  if ( e->isAccepted() )
-    return;
-
-  if ( e->key() == Key_F1 )
-    {
-      e->accept();
-      onHelp();
-    }
+  return "/files/stream_lines_presentation.htm";
 }
index 1d67efd1fc3a39d7bb0333995f96807417f95a7d..08ca73474c2a394db30ec8056c5c1e0bbaed7727 100644 (file)
@@ -43,29 +43,29 @@ namespace VISU
   class StreamLines_i;
 }
 
-class VisuGUI_StreamLinesDlg: public VisuGUI_Prs3dDlg
+class VisuGUI_StreamLinesDlg: public VisuGUI_ScalarBarBaseDlg
 {
     Q_OBJECT
 public:
     VisuGUI_StreamLinesDlg (SalomeApp_Module* theModule);
     ~VisuGUI_StreamLinesDlg();
 
-    virtual void initFromPrsObject(VISU::ColoredPrs3d_i* thePrs, bool theInit = true);
+    virtual void initFromPrsObject( VISU::ColoredPrs3d_i* thePrs,
+                                 bool theInit );
+
     virtual int  storeToPrsObject(VISU::ColoredPrs3d_i* thePrs);
 
     void setColor( QColor color );
     void enableMagnColor( bool enable );
 
-private:
-    void keyPressEvent( QKeyEvent* e );
+protected:
+  virtual QString GetContextHelpFilePath();
 
 protected slots:
   void accept();
   void reject();
-  void onHelp();
 
 private slots:
-//VSR: 08/06/06:  void onSelectionActive(bool theActive);
   void StepLengthChanged(double theValue);
   void IntegrationStepChanged(double theValue);
   void PropagationTimeChanged(double theValue);
@@ -87,7 +87,6 @@ private:
     QComboBox* mySrcCombo;
 
     QTabWidget*            myTabBox;
-    VisuGUI_ScalarBarPane* myScalarPane;
     VisuGUI_InputPane*     myInputPane;
 
     QValueList<VISU::Prs3d_var> myPrsList;
index 49ad4f9a2bb079be31e17a63ecfddd294d9fae92..0cf43b54d3ba58b73372d14003c639cdf795be4d 100644 (file)
@@ -494,7 +494,7 @@ SetupDlg::SetupDlg (QWidget* theParent,
   double aMaxTime = myAnimator->getMaxTime();
   double aMinTime = myAnimator->getMinTime();
   double aStep;
-  if ( myAnimator->getAnimationMode() == 0 ) 
+  if ( myAnimator->getAnimationMode() == VISU::Animation::PARALLEL ) 
     aStep = (aMaxTime - aMinTime) / (myAnimator->getFieldData(0).myNbTimes - 1);
   else { // succcessive animation mode
     std::pair<int,long> aLastFieldFrame(myAnimator->getNbFields() - 1,
@@ -552,9 +552,9 @@ SetupDlg::SetupDlg (QWidget* theParent,
     _PTR(SObject) aSO = myAnimator->getFieldData(i).myField;
     VISU::Storable::TRestoringMap aRestoringMap = VISU::Storable::GetStorableMap(aSO);
     QString aFieldName(aRestoringMap["myName"]);
-    if ( myAnimator->getAnimationMode() == 0 )
+    if ( myAnimator->getAnimationMode() == VISU::Animation::PARALLEL )
       aFieldNames.append(aFieldName);
-    else if ( myAnimator->getAnimationMode() == 1 ) {
+    else if ( myAnimator->getAnimationMode() == VISU::Animation::SUCCESSIVE ) {
       _PTR(SObject) aSObject = aSO->GetFather()->GetFather()->GetFather();
       VISU::Storable::TRestoringMap aRestoringMap = VISU::Storable::GetStorableMap(aSObject);
       QString aFileName(aRestoringMap["myInitFileName"]);
@@ -564,12 +564,12 @@ SetupDlg::SetupDlg (QWidget* theParent,
   }
   myFieldLst->insertStringList(aFieldNames);
   
-  if ( myAnimator->getAnimationMode() == 0 ) {
+  if ( myAnimator->getAnimationMode() == VISU::Animation::PARALLEL ) {
     myFieldLst->setSelected(0, true);
     connect( myFieldLst, SIGNAL( highlighted(int) ),
             this, SLOT( onFieldChange(int) ) );
   }
-  else if ( myAnimator->getAnimationMode() == 1 )
+  else if ( myAnimator->getAnimationMode() == VISU::Animation::SUCCESSIVE )
     myFieldLst->setSelectionMode(QListBox::NoSelection);
   
     QVBox* aSetupBox = new QVBox(aPropFrame);
@@ -590,9 +590,11 @@ SetupDlg::SetupDlg (QWidget* theParent,
   connect( myPropBtn, SIGNAL( clicked() ),
           this, SLOT( onPreferencesDlg() ) );
 
-  if (myAnimator->getNbFields() > 1 && myAnimator->getAnimationMode() == 0) {
-    myArrangeBtn = new QPushButton("Arrange...", aSetupBox);
-    connect( myArrangeBtn, SIGNAL( clicked() ), this, SLOT( onArrangeDlg() ) );
+  if (myAnimator->getNbFields() > 1 ) {
+    if( myAnimator->getAnimationMode() == VISU::Animation::PARALLEL ) {
+      myArrangeBtn = new QPushButton("Arrange...", aSetupBox);
+      connect( myArrangeBtn, SIGNAL( clicked() ), this, SLOT( onArrangeDlg() ) );
+    }
   }
   onFieldChange(0);
   aMainLayout->addWidget(aPropFrame);
@@ -652,7 +654,7 @@ void SetupDlg::onFieldChange (int theIndex)
   bool anEnableItems = false;
   bool anEnableGP = false;
   VISU::VISUType aPrsType;
-  if ( myAnimator->getAnimationMode() == 0 ) { // parallel animation mode
+  if ( myAnimator->getAnimationMode() == VISU::Animation::PARALLEL ) { // parallel animation mode
     
     FieldData& aData = myAnimator->getFieldData(theIndex);
     _PTR(SObject) aSObject = aData.myField;
@@ -666,7 +668,7 @@ void SetupDlg::onFieldChange (int theIndex)
     aPrsType = aData.myPrsType;
 
   }
-  else if ( myAnimator->getAnimationMode() == 1 ) { // succcessive animation mode
+  else if ( myAnimator->getAnimationMode() == VISU::Animation::SUCCESSIVE ) { // succcessive animation mode
     
     for (int i = 0; i < myAnimator->getNbFields(); i++) {
       _PTR(SObject) aSO = myAnimator->getFieldData(i).myField;
@@ -749,7 +751,7 @@ void SetupDlg::onTypeChanged (int theIndex)
   int aType = myComboId2TypeId[theIndex];
   
   for (int i = 0; i < myAnimator->getNbFields(); i++) {
-    FieldData& aData = ( myAnimator->getAnimationMode() == 0 ) ?
+    FieldData& aData = ( myAnimator->getAnimationMode() == VISU::Animation::PARALLEL ) ?
       myAnimator->getFieldData(myFieldLst->currentItem()) :
       myAnimator->getFieldData(i);
 
@@ -787,7 +789,7 @@ void SetupDlg::onTypeChanged (int theIndex)
     }
     myAnimator->clearData(aData);
 
-    if ( myAnimator->getAnimationMode() == 0 ) // parallel animation mode
+    if ( myAnimator->getAnimationMode() == VISU::Animation::PARALLEL ) // parallel animation mode
       break;
   }
   //myPropBtn->setEnabled(aData.myPrsType != VISU::TSCALARMAP);
@@ -805,14 +807,24 @@ namespace
          VISU_TimeAnimation* theAnimator)
   {
     TDialog* aDlg = new TDialog(theModule);
-    aDlg->initFromPrsObject(dynamic_cast<TPrs3d*>(theData.myPrs[0]));
+    TPrs3d* aPrs3d = dynamic_cast<TPrs3d*>(theData.myPrs[0]);
+    aDlg->initFromPrsObject(aPrs3d, true);
     if (aDlg->exec() && aDlg->storeToPrsObject(dynamic_cast<TPrs3d*>(theData.myPrs[0]))) {
-      for (int i = 1; i < theData.myNbFrames; i++)
-       theData.myPrs[i]->SameAs(theData.myPrs[0]);
-      if ( theAnimator->getAnimationMode() == 1 ) {
-       for (int i = 1; i < theAnimator->getNbFields(); i++) {
-         for (int j = 0; j < theAnimator->getFieldData(i).myNbFrames; j++)
-           theAnimator->getFieldData(i).myPrs[j]->SameAs(theData.myPrs[0]);
+
+      for (long aFrameId = 1; aFrameId < theData.myNbFrames; aFrameId++){
+       VISU::ColoredPrs3d_i* aPrs3d = theData.myPrs[aFrameId];
+       aPrs3d->SameAs(theData.myPrs[0]);
+      }
+
+      if ( theAnimator->getAnimationMode() == VISU::Animation::SUCCESSIVE ) {
+       for (int aFieldId = 1; aFieldId < theAnimator->getNbFields(); aFieldId++) {
+         FieldData& aFieldData = theAnimator->getFieldData(aFieldId);
+         for (long aFrameId = 0; aFrameId < aFieldData.myNbFrames; aFrameId++) {
+           VISU::ColoredPrs3d_i* aPrs3d = aFieldData.myPrs[aFrameId];
+           std::string aTitle = aPrs3d->GetCTitle();
+           aPrs3d->SameAs(theData.myPrs[0]);
+           aPrs3d->SetTitle(aTitle.c_str());
+         }
        }
       }
     }
@@ -825,14 +837,16 @@ void SetupDlg::onPreferencesDlg()
 {
   SUIT_OverrideCursor c;
 
-  int id = ( myAnimator->getAnimationMode() == 0 ) ? myFieldLst->currentItem() : 0;
-  FieldData& aData = myAnimator->getFieldData(id);
-  if (aData.myPrs.empty())
-    myAnimator->generatePresentations(id);
+  VISU::Animation::AnimationMode aMode = myAnimator->getAnimationMode();
+  int aRefFieldId = ( aMode == VISU::Animation::PARALLEL ) ? myFieldLst->currentItem() : 0;
+  FieldData& aData = myAnimator->getFieldData(aRefFieldId);
+  if (aData.myPrs.empty()) 
+    myAnimator->generatePresentations(aRefFieldId);
 
-  if ( myAnimator->getAnimationMode() == 1 ) {
+  if ( myAnimator->getAnimationMode() == VISU::Animation::SUCCESSIVE ) {
     for (int i = 0; i < myAnimator->getNbFields(); i++) {
-      if ( i != id && myAnimator->getFieldData(i).myPrs.empty() ) myAnimator->generatePresentations(i);
+      if ( i != aRefFieldId && myAnimator->getFieldData(i).myPrs.empty() ) 
+       myAnimator->generatePresentations(i);
     }
   }
 
@@ -849,27 +863,27 @@ void SetupDlg::onPreferencesDlg()
   switch (aType) {
   case TSCALARMAP_ITEM: //Scalar Map
     c.suspend();
-    EditPrs<VISU::ScalarMap_i,VisuGUI_ScalarBarDlg>(myModule,aData,myAnimator);
+    EditPrs<VISU::ScalarMap_i, VisuGUI_ScalarBarDlg>(myModule, aData, myAnimator);
     break;
   case TISOSURFACES_ITEM: //Iso Surfaces
     c.suspend();
-    EditPrs<VISU::IsoSurfaces_i,VisuGUI_IsoSurfacesDlg>(myModule,aData,myAnimator);
+    EditPrs<VISU::IsoSurfaces_i, VisuGUI_IsoSurfacesDlg>(myModule, aData, myAnimator);
     break;
   case TCUTPLANES_ITEM: //Cut Planes
     c.suspend();
-    EditPrs<VISU::CutPlanes_i,VisuGUI_CutPlanesDlg>(myModule,aData,myAnimator);
+    EditPrs<VISU::CutPlanes_i, VisuGUI_CutPlanesDlg>(myModule, aData, myAnimator);
     break;
   case TCUTLINES_ITEM: //Cut Lines
     c.suspend();
-    EditPrs<VISU::CutLines_i,VisuGUI_CutLinesDlg>(myModule,aData,myAnimator);
+    EditPrs<VISU::CutLines_i, VisuGUI_CutLinesDlg>(myModule, aData, myAnimator);
     break;
   case TPLOT3D_ITEM: //Plot 3D
     c.suspend();
-    EditPrs<VISU::Plot3D_i,VisuGUI_Plot3DDlg>(myModule,aData,myAnimator);
+    EditPrs<VISU::Plot3D_i, VisuGUI_Plot3DDlg>(myModule, aData, myAnimator);
     break;
   case TDEFORMEDSHAPE_ITEM: //Deformed Shape
     c.suspend();
-    EditPrs<VISU::DeformedShape_i,VisuGUI_DeformedShapeDlg>(myModule,aData,myAnimator);
+    EditPrs<VISU::DeformedShape_i, VisuGUI_DeformedShapeDlg>(myModule, aData, myAnimator);
     break;
   case TSCALARMAPONDEFORMEDSHAPE_ITEM: //Scalar Map on Deformed Shape
     c.suspend();
@@ -877,7 +891,8 @@ void SetupDlg::onPreferencesDlg()
       typedef VisuGUI_ScalarMapOnDeformedShapeDlg DLG;
       typedef VISU::ScalarMapOnDeformedShape_i TYPE;
       DLG* aDlg = new DLG (myModule);
-      aDlg->initFromPrsObject(dynamic_cast<TYPE*>(aData.myPrs[0]));
+      TYPE* aPrs3d = dynamic_cast<TYPE*>(aData.myPrs[0]);
+      aDlg->initFromPrsObject(aPrs3d, true);
       if (aDlg->exec() && aDlg->storeToPrsObject(aData.myPrs[0])) { 
        for (int i = 1; i < aData.myNbFrames; i++){
          aData.myPrs[i]->SameAs(aData.myPrs[0]);
@@ -888,15 +903,15 @@ void SetupDlg::onPreferencesDlg()
     break;
   case TVECTORS_ITEM: //Vectors
     c.suspend();
-    EditPrs<VISU::Vectors_i,VisuGUI_VectorsDlg>(myModule,aData,myAnimator);
+    EditPrs<VISU::Vectors_i, VisuGUI_VectorsDlg>(myModule, aData, myAnimator);
     break;
   case TSTREAMLINES_ITEM: //Stream Lines
     c.suspend();
-    EditPrs<VISU::StreamLines_i,VisuGUI_StreamLinesDlg>(myModule,aData,myAnimator);
+    EditPrs<VISU::StreamLines_i, VisuGUI_StreamLinesDlg>(myModule, aData, myAnimator);
     break;
   case TGAUSSPOINTS_ITEM: //Gauss Points
     c.suspend();
-    EditPrs<VISU::GaussPoints_i,VisuGUI_GaussPointsDlg>(myModule,aData,myAnimator);
+    EditPrs<VISU::GaussPoints_i, VisuGUI_GaussPointsDlg>(myModule, aData, myAnimator);
     break;
   }
 }
@@ -912,22 +927,13 @@ void SetupDlg::onArrangeDlg()
 //------------------------------------------------------------------------
 void SetupDlg::onRangeCheck (bool theCheck)
 {
-//   for (int i = 0; i < myAnimator->getNbFields(); i++)
-//     myAnimator->clearData(myAnimator->getFieldData(i));
-
   myMinVal->setEnabled(theCheck);
   myMaxVal->setEnabled(theCheck);
 
   if (!theCheck)
     myAnimator->setAnimationRange(0, 0);
-  else {
-    //    if (myMinVal->value() < myMaxVal->value())
+  else
     myAnimator->setAnimationRange(myMinVal->value(), myMaxVal->value());
-//     else if (myMinVal->value() > myMaxVal->value())
-//       myAnimator->setAnimationRange(myMaxVal->value(), myMinVal->value());
-//     else // equal case
-//       myAnimator->setAnimationRange(0, 0);
-  }
 }
 
 //------------------------------------------------------------------------
@@ -1063,7 +1069,9 @@ static const char * pauseIco[] = {
 static QPixmap MYpausePixmap(pauseIco);
 
 
-VisuGUI_TimeAnimationDlg::VisuGUI_TimeAnimationDlg (VisuGUI* theModule, _PTR(Study) theStudy, int theMode) :
+VisuGUI_TimeAnimationDlg::VisuGUI_TimeAnimationDlg (VisuGUI* theModule,
+                                                   _PTR(Study) theStudy, 
+                                                   VISU::Animation::AnimationMode theMode) :
   QDialog(VISU::GetDesktop(theModule), 
          "VisuGUI_TimeAnimationDlg", 
          false, 
@@ -1071,9 +1079,9 @@ VisuGUI_TimeAnimationDlg::VisuGUI_TimeAnimationDlg (VisuGUI* theModule, _PTR(Stu
   myModule(theModule),
   mySetupDlg(NULL)
 {
-  if ( theMode == 0 )
+  if ( theMode == VISU::Animation::PARALLEL )
     setCaption(tr("PARALLEL_ANIMATION"));
-  else if ( theMode == 1 )
+  else
     setCaption(tr("SUCCESSIVE_ANIMATION"));
   setSizeGripEnabled( TRUE );
 
@@ -1617,7 +1625,7 @@ void VisuGUI_TimeAnimationDlg::restoreFromStudy(_PTR(SObject) theAnimation)
 {
   myAnimator->restoreFromStudy(theAnimation);
   mySaveBtn->setEnabled(myAnimator->isSavedInStudy());
-  if ( myAnimator->getAnimationMode() == 1 ) 
+  if ( myAnimator->getAnimationMode() == VISU::Animation::SUCCESSIVE ) 
     setCaption(tr("SUCCESSIVE_ANIMATION"));
 }
 
index 70bd9952deb5ce4fe7bdc1a2939a4b28613f5d7c..a3640e602a31eeecaf34e28eb9b2d4dbe923e657 100644 (file)
 
 #include "VTKViewer.h"
 
+// IDL headers
+#include "SALOMEconfig.h"
+#include CORBA_SERVER_HEADER(VISU_Gen)
+
 #include <qdialog.h>
 #include <qbuttongroup.h>
 #include <qwidgetstack.h>
@@ -150,7 +154,9 @@ class VisuGUI_TimeAnimationDlg: public QDialog
 {
     Q_OBJECT
  public:
-    VisuGUI_TimeAnimationDlg(VisuGUI* theModule, _PTR(Study) theStudy, int theMode=0);
+    VisuGUI_TimeAnimationDlg(VisuGUI* theModule,
+                            _PTR(Study) theStudy, 
+                            VISU::Animation::AnimationMode theMode = VISU::Animation::PARALLEL);
     ~VisuGUI_TimeAnimationDlg();
 
     bool addField(_PTR(SObject) theField);
index 612271daadca2f4c7dced317b83160df1374120d..f4fbd569227e8f5ee09ced911be5011c0804a849 100644 (file)
@@ -52,7 +52,7 @@ using namespace std;
   Constructor
 */
 VisuGUI_VectorsDlg::VisuGUI_VectorsDlg (SalomeApp_Module* theModule)
-  : VisuGUI_Prs3dDlg(theModule)
+  : VisuGUI_ScalarBarBaseDlg(theModule)
 {
   setCaption(tr("DLG_TITLE"));
   setSizeGripEnabled(TRUE);
@@ -172,10 +172,8 @@ VisuGUI_VectorsDlg::VisuGUI_VectorsDlg (SalomeApp_Module* theModule)
 
   // top layout
   myTabBox->addTab(aBox, "Vectors");
-  myScalarPane = new VisuGUI_ScalarBarPane(this, false);
-  myScalarPane->setMargin( 5 );
   myInputPane = new VisuGUI_InputPane(VISU::TVECTORS, theModule, this);
-  myTabBox->addTab(myScalarPane, "Scalar Bar");  
+  myTabBox->addTab(GetScalarPane(), "Scalar Bar");  
   myTabBox->addTab(myInputPane, "Input");
 
   TopLayout->addWidget( myTabBox );
@@ -202,11 +200,13 @@ VisuGUI_VectorsDlg::VisuGUI_VectorsDlg (SalomeApp_Module* theModule)
 VisuGUI_VectorsDlg::~VisuGUI_VectorsDlg()
 {}
 
-void VisuGUI_VectorsDlg::initFromPrsObject(VISU::ColoredPrs3d_i* thePrs, bool theInit) {
+void VisuGUI_VectorsDlg::initFromPrsObject( VISU::ColoredPrs3d_i* thePrs,
+                                           bool theInit )
+{
   if( theInit )
     myPrsCopy = VISU::TSameAsFactory<VISU::TVECTORS>().Create(thePrs, VISU::ColoredPrs3d_i::EDoNotPublish);
 
-  myScalarPane->initFromPrsObject( myPrsCopy );
+  VisuGUI_ScalarBarBaseDlg::initFromPrsObject(myPrsCopy, theInit);
 
   setScaleFactor(myPrsCopy->GetScale());
   setLineWidth((int)myPrsCopy->GetLineWidth());
@@ -234,11 +234,11 @@ void VisuGUI_VectorsDlg::initFromPrsObject(VISU::ColoredPrs3d_i* thePrs, bool th
 
 int VisuGUI_VectorsDlg::storeToPrsObject(VISU::ColoredPrs3d_i* thePrs)
 {
-  if(!myInputPane->check() || !myScalarPane->check())
+  if(!myInputPane->check() || !GetScalarPane()->check())
     return 0;
   
   int anIsOk = myInputPane->storeToPrsObject( myPrsCopy );
-  anIsOk &= myScalarPane->storeToPrsObject( myPrsCopy );
+  anIsOk &= GetScalarPane()->storeToPrsObject( myPrsCopy );
   
   myPrsCopy->SetScale(getScaleFactor());
   myPrsCopy->SetLineWidth(getLineWidth());
@@ -437,51 +437,7 @@ void VisuGUI_VectorsDlg::enableMagnColor( bool enable )
 }
 
 
-void VisuGUI_VectorsDlg::accept() {
-  if (myScalarPane->check()) 
-    {
-      myScalarPane->deletePreview();
-      QDialog::accept();
-    }
-}
-
-void VisuGUI_VectorsDlg::reject()
+QString VisuGUI_VectorsDlg::GetContextHelpFilePath()
 {
-  myScalarPane->deletePreview();
-  QDialog::reject();
-}
-
-void VisuGUI_VectorsDlg::onHelp()
-{
-  QString aHelpFileName = "/files/vectors_presentation.htm";
-  LightApp_Application* app = (LightApp_Application*)(SUIT_Session::session()->activeApplication());
-  if (app) {
-    VisuGUI* aVisuGUI = dynamic_cast<VisuGUI*>( app->activeModule() );
-    app->onHelpContextModule(aVisuGUI ? app->moduleName(aVisuGUI->moduleName()) : QString(""), aHelpFileName);
-  }
-  else {
-               QString platform;
-#ifdef WIN32
-               platform = "winapplication";
-#else
-               platform = "application";
-#endif
-    SUIT_MessageBox::warn1(0, QObject::tr("WRN_WARNING"),
-                          QObject::tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
-                          arg(app->resourceMgr()->stringValue("ExternalBrowser", platform)).arg(aHelpFileName),
-                          QObject::tr("BUT_OK"));
-  }
-}
-
-void VisuGUI_VectorsDlg::keyPressEvent( QKeyEvent* e )
-{
-  QDialog::keyPressEvent( e );
-  if ( e->isAccepted() )
-    return;
-
-  if ( e->key() == Key_F1 )
-    {
-      e->accept();
-      onHelp();
-    }
+  return "/files/vectors_presentation.htm";
 }
index 829747fccab062aa113934ebe5b15862ade40bb4..7fae9ccbf9e466cc6ec8eeb4b1491f6f7a25209e 100644 (file)
@@ -53,7 +53,7 @@ namespace VISU
   class Vectors_i;
 }
 
-class VisuGUI_VectorsDlg : public VisuGUI_Prs3dDlg
+class VisuGUI_VectorsDlg : public VisuGUI_ScalarBarBaseDlg
 {
     Q_OBJECT
 
@@ -79,17 +79,13 @@ public:
     VISU::Vectors::GlyphPos getGlyphPos();
     void   enableMagnColor( bool enable );
 
-    virtual void initFromPrsObject(VISU::ColoredPrs3d_i* thePrs, bool theInit = true);
-    virtual int  storeToPrsObject(VISU::ColoredPrs3d_i* thePrs);
+    virtual void initFromPrsObject( VISU::ColoredPrs3d_i* thePrs,
+                                   bool theInit );
 
-private:
-    void keyPressEvent( QKeyEvent* e );
-  
+    virtual int  storeToPrsObject(VISU::ColoredPrs3d_i* thePrs);
 
 protected slots:
-  void accept();
-  void reject();
-  void onHelp();
+  virtual QString GetContextHelpFilePath();
 
 private:
     QGroupBox*      TopGroup;
index 3556d534f01ec79eab5b4aa7def7ec73acc63c42..521bafa60154df0cd902bc43d45ee88d15cb10bf 100644 (file)
@@ -130,14 +130,11 @@ namespace VISU
 
 
   //---------------------------------------------------------------
-#ifndef WNT
-  inline
-#endif
   VISU_Actor*
   UpdateViewer(VisuGUI* theModule,
                VISU::Prs3d_i* thePrs,
                bool theDispOnly = false,
-                          const bool theIsHighlight = false);
+              const bool theIsHighlight = false);
 
 
   //---------------------------------------------------------------
index 83cd25457417995188356cca6709a0c8bc376611..5492b59509077b5454ff42914f8b53b34590102d 100644 (file)
@@ -70,9 +70,9 @@ namespace SALOME
     {}
 
     //! Initialize smart pointer to given object (TSGenericObj must be complete).
-    template<class TSGenericObj>
+    template<class TGenObj>
     explicit
-    GenericObjPtr(TSGenericObj* thePointer): 
+    GenericObjPtr(TGenObj* thePointer): 
       myPointer(thePointer) 
     {
       this->Register();
@@ -88,6 +88,17 @@ namespace SALOME
       this->Register();
     }
 
+    /*! 
+      Initialize smart pointer with a new reference to the same object
+      referenced by given smart pointer.
+     */
+    template<class TGenObj>
+    GenericObjPtr(const GenericObjPtr<TGenObj>& thePointer):
+      myPointer(thePointer.get()) 
+    {
+      this->Register();
+    }
+
     //! Destroy smart pointer and remove the reference to its object.
     ~GenericObjPtr()
     {
@@ -98,8 +109,9 @@ namespace SALOME
       Assign object to reference.  This removes any reference to an old
       object.
     */
+    template<class TGenObj>
     GenericObjPtr&
-    operator=(TGenericObj* thePointer)
+    operator=(TGenObj* thePointer)
     {
       GenericObjPtr aTmp(thePointer);
       aTmp.swap(*this);
@@ -118,6 +130,19 @@ namespace SALOME
       return *this;
     }
 
+    /*! 
+      Assign object to reference.  This removes any reference to an old
+      object.
+    */
+    template<class TGenObj>
+    GenericObjPtr& 
+    operator=(const GenericObjPtr<TGenObj>& thePointer)
+    {
+      GenericObjPtr aTmp(thePointer);
+      aTmp.swap(*this);
+      return *this;
+    }
+
     //! Get the contained pointer.
     virtual
     TGenericObj* 
index d6bbf4777df446219da11e4a9541df10c2d143bd..45ace2f3cccfbeea2f8d5b5b54522387f7adebc4 100644 (file)
@@ -94,10 +94,10 @@ namespace
          break;
        VISU::ColoredPrs3dHolder::BasicInput_var anInput = aPrs3d->GetBasicInput();
        if(IsSameField(theInput, anInput))
-         return aPrs3d.get();
+         return aPrs3d;
       }
     }
-    return VISU::TPrs3dPtr();
+    return NULL;
   }
   
   
index 2998dd50130a008d9296ecc6361ccd6775921af7..7b2c2a6cc954ebb7122bde288824b5052b036cd9 100644 (file)
@@ -74,6 +74,74 @@ namespace
   }
 }
 
+//---------------------------------------------------------------
+namespace VISU
+{
+  //---------------------------------------------------------------
+  vtkFloatingPointType
+  TMinMaxController
+  ::GetComponentMin(vtkIdType theCompID)
+  {
+    return VTK_LARGE_FLOAT;
+  }
+
+
+  //---------------------------------------------------------------
+  vtkFloatingPointType
+  TMinMaxController
+  ::GetComponentMax(vtkIdType theCompID)
+  {
+    return -VTK_LARGE_FLOAT;
+  }
+
+
+  //---------------------------------------------------------------
+  struct TSimpleMinMaxController: virtual TVTKMinMaxController
+  {
+    VISU::PField myField;
+    
+    TSimpleMinMaxController(VISU::PField theField)
+    {
+      myField = theField;
+    }
+    
+    virtual
+    vtkFloatingPointType
+    GetComponentMin(vtkIdType theCompID)
+    {
+      if(myField){
+       TMinMax aMinMax = myField->GetMinMax(theCompID);
+       return aMinMax.first;
+      }
+      return TMinMaxController::GetComponentMin(theCompID);
+    }
+
+    virtual
+    vtkFloatingPointType
+    GetComponentMax(vtkIdType theCompID)
+    {
+      if(myField){
+       TMinMax aMinMax = myField->GetMinMax(theCompID);
+       return aMinMax.second;
+      }
+      return TMinMaxController::GetComponentMax(theCompID);
+    }
+  };
+
+
+  //---------------------------------------------------------------
+  PMinMaxController
+  CreateDefaultMinMaxController(VISU::ColoredPrs3d_i* theColoredPrs3d)
+  {
+    PField aField = theColoredPrs3d->GetScalarField();
+    return PMinMaxController(new TSimpleMinMaxController(aField));
+  }
+
+
+  //---------------------------------------------------------------
+}
+
+
 //---------------------------------------------------------------
 VISU::ColoredPrs3d_i::
 ColoredPrs3d_i(EPublishInStudyMode thePublishInStudyMode) :
@@ -89,6 +157,22 @@ VISU::ColoredPrs3d_i
 ::~ColoredPrs3d_i()
 {}
 
+//---------------------------------------------------------------
+void
+VISU::ColoredPrs3d_i
+::Register()
+{
+  TSuperClass::Register();
+}
+
+//---------------------------------------------------------------
+void
+VISU::ColoredPrs3d_i
+::Destroy()
+{
+  TSuperClass::Destroy();
+}
+
 //---------------------------------------------------------------
 void 
 VISU::ColoredPrs3d_i
@@ -277,9 +361,9 @@ VISU::ColoredPrs3d_i
 
 
 //----------------------------------------------------------------------------
-const VISU::PField&
+VISU::PField
 VISU::ColoredPrs3d_i
-::GetField() const 
+::GetField()
 { 
   return myField;
 }
@@ -357,14 +441,35 @@ VISU::ColoredPrs3d_i
 
 
 //----------------------------------------------------------------------------
-const VISU::PField&
+VISU::PField
 VISU::ColoredPrs3d_i
-::GetScalarField() const
+::GetScalarField()
 {
   return myField;
 }
 
 
+//----------------------------------------------------------------------------
+VISU::PMinMaxController
+VISU::ColoredPrs3d_i
+::GetMinMaxController()
+{
+  return myMinMaxController;
+}
+
+
+//----------------------------------------------------------------------------
+void
+VISU::ColoredPrs3d_i
+::SetMinMaxController(const VISU::PMinMaxController& theController)
+{
+  myMinMaxController = theController;
+
+  if(!IsRangeFixed())
+    SetSourceRange();
+}
+
+
 //----------------------------------------------------------------------------
 CORBA::Long
 VISU::ColoredPrs3d_i
@@ -508,7 +613,7 @@ VISU::ColoredPrs3d_i
 {
   if(const ColoredPrs3d_i* aPrs3d = dynamic_cast<const ColoredPrs3d_i*>(theOrigin)){
     ColoredPrs3d_i* anOrigin = const_cast<ColoredPrs3d_i*>(aPrs3d);
+
     bool anIsCreatNew = OnSetInput(false);
     if(anIsCreatNew)
       Build(ESameAs);
@@ -525,8 +630,8 @@ VISU::ColoredPrs3d_i
     SetNbColors(anOrigin->GetNbColors());
     SetBarOrientation(anOrigin->GetBarOrientation());
     
-    //  "SetRange" function changes "myIsFixedRange" attribute,
-    // so, it is necessary pay a special attention if "this" equal to "theOrigin"
+    SetMinMaxController(anOrigin->GetMinMaxController());
+
     if(anOrigin->IsRangeFixed())
       SetRange(anOrigin->GetMin(), anOrigin->GetMax());
     else
@@ -627,8 +732,7 @@ VISU::ColoredPrs3d_i
     ProcessVoidEvent(new TVoidMemFunEvent<VISU_ColoredPL>
                     (GetSpecificPL(), &VISU_ColoredPL::SetSourceRange));
   }else{
-    TMinMax aTMinMax = GetField()->GetMinMax(GetScalarMode());
-    vtkFloatingPointType aScalarRange[2] = {aTMinMax.first, aTMinMax.second};
+    vtkFloatingPointType aScalarRange[2] = {GetSourceMin(), GetSourceMax()};
     ProcessVoidEvent(new TVoidMemFun1ArgEvent<VISU_ColoredPL, vtkFloatingPointType*>
                     (GetSpecificPL(), &VISU_ColoredPL::SetScalarRange, aScalarRange));
   }
@@ -644,10 +748,8 @@ VISU::ColoredPrs3d_i
     vtkFloatingPointType aRange[2];
     GetSpecificPL()->GetSourceRange(aRange);
     return aRange[0];
-  }else{
-    TMinMax aTMinMax = GetField()->GetMinMax(GetScalarMode());
-    return aTMinMax.first;
   }
+  return GetComponentMin(GetScalarMode());
 }
 
 //----------------------------------------------------------------------------
@@ -659,10 +761,32 @@ VISU::ColoredPrs3d_i
     vtkFloatingPointType aRange[2];
     GetSpecificPL()->GetSourceRange(aRange);
     return aRange[1];
-  }else{
-    TMinMax aTMinMax = GetField()->GetMinMax(GetScalarMode());
-    return aTMinMax.second;
   }
+  return GetComponentMax(GetScalarMode());
+}
+
+//----------------------------------------------------------------------------
+CORBA::Double 
+VISU::ColoredPrs3d_i
+::GetComponentMin(vtkIdType theCompID)
+{
+  if(PMinMaxController aMinMaxController = GetMinMaxController())
+    return aMinMaxController->GetComponentMin(theCompID);
+
+  TMinMax aTMinMax = GetField()->GetMinMax(theCompID);
+  return aTMinMax.first;
+}
+
+//----------------------------------------------------------------------------
+vtkFloatingPointType 
+VISU::ColoredPrs3d_i
+::GetComponentMax(vtkIdType theCompID)
+{
+  if(PMinMaxController aMinMaxController = GetMinMaxController())
+    return aMinMaxController->GetComponentMax(theCompID);
+
+  TMinMax aTMinMax = GetField()->GetMinMax(theCompID);
+  return aTMinMax.second;
 }
 
 //----------------------------------------------------------------------------
index d1e64283c3233ae76750aa2622d2fe2626628d11..63d54e63cd2a1d299159de958df244602efbc2dc 100644 (file)
 #include "VISU_Prs3d_i.hh"
 #include "VISU_Result_i.hh"
 #include "VISU_BoostSignals.h"
+#include "SALOME_GenericObjPointer.hh"
 
 class VISU_ColoredPL;
 
 namespace VISU
 {
+  //----------------------------------------------------------------------------
+  struct TMinMaxController
+  {
+    virtual
+    vtkFloatingPointType
+    GetComponentMin(vtkIdType theCompID);
+
+    virtual
+    vtkFloatingPointType
+    GetComponentMax(vtkIdType theCompID);
+
+    virtual
+    void
+    Register() = 0;
+
+    virtual
+    void
+    Destroy() = 0;
+  };
+  typedef SALOME::GenericObjPtr<TMinMaxController> PMinMaxController;
+
+
+  //----------------------------------------------------------------------------
+  struct TVTKMinMaxController: virtual TMinMaxController,
+                              virtual vtkObjectBase
+  {
+    virtual
+    void
+    Register()
+    {
+      vtkObjectBase::Register(NULL);
+    }
+
+    virtual
+    void
+    Destroy()
+    {
+      vtkObjectBase::Delete();
+    }
+  };
+
+
+  //----------------------------------------------------------------------------
+  class ColoredPrs3d_i;
+
+  PMinMaxController
+  CreateDefaultMinMaxController(VISU::ColoredPrs3d_i* theColoredPrs3d);
+  
+
   //----------------------------------------------------------------------------
   class VISU_I_EXPORT ColoredPrs3d_i : public virtual POA_VISU::ColoredPrs3d,
+                                      public virtual TMinMaxController,
                                       public virtual TResultObserver,
                                       public virtual Prs3d_i
   {
@@ -58,6 +109,14 @@ namespace VISU
     virtual
     ~ColoredPrs3d_i();
 
+    virtual
+    void
+    Register();
+
+    virtual
+    void
+    Destroy();
+
     virtual
     void
     RemoveFromStudy();
@@ -92,8 +151,8 @@ namespace VISU
     GetCFieldName() const;
 
     virtual 
-    const VISU::PField&
-    GetField() const;
+    VISU::PField
+    GetField();
 
     virtual
     void 
@@ -112,8 +171,14 @@ namespace VISU
     GetTimeStampIndexByNumber( CORBA::Long theNumber );
 
     virtual 
-    const VISU::PField&
-    GetScalarField() const;
+    VISU::PField
+    GetScalarField();
+
+    VISU::PMinMaxController
+    GetMinMaxController();
+
+    void
+    SetMinMaxController(const VISU::PMinMaxController& theController);
 
     virtual
     CORBA::Long
@@ -152,6 +217,14 @@ namespace VISU
     void
     SetRange(CORBA::Double theMin, CORBA::Double theMax);
 
+    virtual
+    vtkFloatingPointType
+    GetComponentMin(vtkIdType theCompID);
+
+    virtual
+    vtkFloatingPointType
+    GetComponentMax(vtkIdType theCompID);
+
     virtual
     CORBA::Double 
     GetSourceMin();
@@ -482,6 +555,7 @@ namespace VISU
     bool myIsTimeStampFixed;
 
     PField myField;
+    PMinMaxController myMinMaxController;
     EPublishInStudyMode myPublishInStudyMode;
 
     std::string myHolderEntry;
@@ -510,6 +584,7 @@ namespace VISU
     bool myIsFixedRange;
   };
 
+
   //----------------------------------------------------------------------------
   template<class TColoredPrs3d>
   Storable* 
@@ -521,6 +596,8 @@ namespace VISU
     TColoredPrs3d* aColoredPrs3d = new TColoredPrs3d(ColoredPrs3d_i::EDoNotPublish);
     return aColoredPrs3d->Restore(theSObject, theMap);
   }
+
+
   //----------------------------------------------------------------------------
 }
 
index 53ffb8e7e5ce660a533f11866d6a4cbd30d3a5cd..000807286f0f322b88b82ac339340ddc30d61f6d 100644 (file)
@@ -71,9 +71,9 @@ VISU::ScalarMapOnDeformedShape_i
                                                           theEntity,
                                                           theFieldName,
                                                           theTimeStampNumber);
-      const VISU::PField aField = anInput->GetField(theMeshName,
-                                                   (VISU::TEntity)theEntity,
-                                                   theFieldName);
+      VISU::PField aField = anInput->GetField(theMeshName,
+                                             (VISU::TEntity)theEntity,
+                                             theFieldName);
       if(aField->myNbComp <= 1)
        return 0;
 
@@ -396,9 +396,9 @@ VISU::ScalarMapOnDeformedShape_i
 
 
 //---------------------------------------------------------------
-const VISU::PField&
+VISU::PField
 VISU::ScalarMapOnDeformedShape_i
-::GetScalarField() const
+::GetScalarField()
 {
   return myScalarField;
 }
index b4c8d40eb4e3f10ed24d0741b9341298420b00e6..83f2e64d716639949c77c7a83ca79ab17d7d2411 100644 (file)
@@ -164,8 +164,8 @@ namespace VISU
     GetScalarTimeStampNumber();
 
     virtual 
-    const VISU::PField&
-    GetScalarField() const;
+    VISU::PField
+    GetScalarField();
 
   private:
     VISU_ScalarMapOnDeformedShapePL *myScalarMapOnDeformedShapePL;
index 5e1674bb5d7618b8504b85ac782b2ba860d0c3b3..0804801c6a6980bdf56be3e455533395ce2e8ec2 100644 (file)
 #include "CASCatch.hxx"
 #endif
 
-using namespace std;
 
-namespace VISU {
-  class ExecutionState {
+//------------------------------------------------------------------------
+namespace VISU 
+{
+  //------------------------------------------------------------------------
+  class ExecutionState 
+  {
     bool myIsActive;
     QMutex myIsActiveMutex;
   public:
@@ -107,6 +110,50 @@ namespace VISU {
       return state;
     }
   };
+
+
+  //------------------------------------------------------------------------
+  struct TCompositeMinMaxController : virtual TVTKMinMaxController
+  {
+    typedef std::vector<VISU::PMinMaxController> TMinMaxContainer;
+    TMinMaxContainer myMinMaxContainer;    
+
+    void
+    AddController(VISU::PMinMaxController theMinMaxController)
+    {
+      myMinMaxContainer.push_back(theMinMaxController);
+    }
+
+    virtual
+    vtkFloatingPointType
+    GetComponentMin(vtkIdType theCompID)
+    {
+      vtkFloatingPointType aMin = TMinMaxController::GetComponentMin(theCompID);
+      if(!myMinMaxContainer.empty()){
+       for(size_t anId = 0; anId < myMinMaxContainer.size(); anId++){
+         VISU::PMinMaxController aMinMaxController = myMinMaxContainer[anId];
+         aMin = std::min(aMin, aMinMaxController->GetComponentMin(theCompID));
+       }
+      }
+      return aMin;
+    }
+
+    virtual
+    vtkFloatingPointType
+    GetComponentMax(vtkIdType theCompID)
+    {
+      vtkFloatingPointType aMax = TMinMaxController::GetComponentMax(theCompID);
+      if(!myMinMaxContainer.empty()){
+       for(size_t anId = 0; anId < myMinMaxContainer.size(); anId++){
+         VISU::PMinMaxController aMinMaxController = myMinMaxContainer[anId];
+         aMax = std::max(aMax, aMinMaxController->GetComponentMax(theCompID));
+       }
+      }
+      return aMax;
+    }
+  };
+
+  typedef SALOME::GenericObjPtr<TCompositeMinMaxController> PCompositeMinMaxController;
 }
 
 //------------------------------------------------------------------------
@@ -127,7 +174,7 @@ VISU_TimeAnimation::VISU_TimeAnimation (_PTR(Study) theStudy,
     connect( myView, SIGNAL( destroyed() ), this, SLOT( onViewDeleted() ) );
   }
 
-  myAnimationMode = 0;
+  myAnimationMode = VISU::Animation::PARALLEL;
   myTimeMinVal = 0;
   myTimeMaxVal = 0;
   myTimeMin = 0;
@@ -205,7 +252,7 @@ bool VISU_TimeAnimation::addField (_PTR(SObject) theField)
 
   aNewData.myNbTimes = VISU::Storable::FindValue(aMap,"myNbTimeStamps").toLong();
 
-  if ( myAnimationMode == 0 ) { // parallel animation mode
+  if ( myAnimationMode == VISU::Animation::PARALLEL ) { // parallel animation mode
     if ( aNewData.myNbTimes < 2 )
       return false;
     if ( !myFieldsLst.isEmpty() && myFieldsLst.first().myNbTimes != aNewData.myNbTimes )
@@ -304,8 +351,6 @@ namespace
                        CORBA::Double theTimeMin,
                        CORBA::Double theTimeMax)
   {
-    double aMin = VTK_LARGE_FLOAT, aMax = -VTK_LARGE_FLOAT;
-
     _PTR(ChildIterator) anIter = theStudy->NewChildIterator(theData.myField);
     anIter->Next(); // First is reference on support
 
@@ -348,10 +393,8 @@ namespace
         try{
 #endif
           if(aPresent->Apply(false)){
-            anIsCreated = true;
             theData.myPrs[aFrameId++] = aPresent;
-            aMin = std::min(aPresent->GetMin(), aMin);
-            aMax = std::max(aPresent->GetMax(), aMax);
+            anIsCreated = true;
           }
 #ifdef NO_CAS_CATCH
         }catch(Standard_Failure) {
@@ -376,22 +419,15 @@ namespace
       if(!anIsCreated)
        aPresent->_remove_ref();
     }
+
     theData.myNbFrames = aFrameId;
 
-    if (theData.myPrsType != VISU::TGAUSSPOINTS){
-      int aRangeType = VISU::GetResourceMgr()->integerValue("VISU" , "scalar_range_type", 0);
-      if( aRangeType != 1 ){
-       for(long aFrameId = 0; aFrameId < theData.myNbFrames; aFrameId++) {
-         if (VISU::ScalarMap_i* aPrs = dynamic_cast<VISU::ScalarMap_i*>(theData.myPrs[aFrameId])){
-           aPrs->SetRange(aMin, aMax);
-           aPrs->SetOffset(theData.myOffset);
-         }
+    if (theData.myPrsType != VISU::TGAUSSPOINTS) {
+      for(long aFrameId = 0; aFrameId < theData.myNbFrames; aFrameId++) {
+       if (VISU::ScalarMap_i* aPrs = dynamic_cast<VISU::ScalarMap_i*>(theData.myPrs[aFrameId])){
+         aPrs->SetOffset(theData.myOffset);
        }
       }
-      if (theData.myPrsType == VISU::TISOSURFACES)
-       for (long aFrameId = 0; aFrameId < theData.myNbFrames; aFrameId++)
-         if (VISU::IsoSurfaces_i* aPrs = dynamic_cast<VISU::IsoSurfaces_i*>(theData.myPrs[aFrameId]))
-           aPrs->SetSubRange(aMin, aMax);
     }
   }
 }
@@ -533,7 +569,7 @@ void VISU_TimeAnimation::generatePresentations(CORBA::Long theFieldNum) {
     return;
   }
   
-  if ( myAnimationMode == 1 ) { // succcessive animation mode
+  if ( myAnimationMode == VISU::Animation::SUCCESSIVE ) { // successive animation mode
     if ( isRangeDefined() ) {
       if ( myFieldsAbsFrames.size() == getNbFields() ) 
        myFieldsAbsFrames.clear();
@@ -542,18 +578,37 @@ void VISU_TimeAnimation::generatePresentations(CORBA::Long theFieldNum) {
       else
        myFieldsAbsFrames.push_back(aData.myNbFrames);
     }
-    if ((theFieldNum == getNbFields() - 1) && aData.myPrsType != VISU::TGAUSSPOINTS){
-      double aMin = getMinFieldsValue(myFieldsLst);
-      double aMax = getMaxFieldsValue(myFieldsLst);
-      for (int i = 0; i < getNbFields(); i++)
-       for(long aFrameId = 0; aFrameId < myFieldsLst[i].myNbFrames; aFrameId++)
-         if (aData.myPrsType == VISU::TISOSURFACES) {
-           if (VISU::IsoSurfaces_i* aPrs = dynamic_cast<VISU::IsoSurfaces_i*>(myFieldsLst[i].myPrs[aFrameId]))
-           aPrs->SetSubRange(aMin, aMax);
+
+    if (theFieldNum == getNbFields() - 1) {
+      if ( aData.myPrsType != VISU::TGAUSSPOINTS) {
+
+       // Initialize the MinMax controller
+       VISU::PCompositeMinMaxController aMinMaxController(new VISU::TCompositeMinMaxController());
+       if ( myAnimationMode == VISU::Animation::PARALLEL ) {
+         FieldData& aFieldData = getFieldData(theFieldNum);
+         VISU::ColoredPrs3d_i* aPrs3d = aFieldData.myPrs[0];
+         aMinMaxController->AddController(VISU::CreateDefaultMinMaxController(aPrs3d));
+       } else {
+         for (int aFieldId = 0; aFieldId < getNbFields(); aFieldId++) {
+           FieldData& aFieldData = getFieldData(aFieldId);
+           VISU::ColoredPrs3d_i* aPrs3d = aFieldData.myPrs[0];
+           aMinMaxController->AddController(VISU::CreateDefaultMinMaxController(aPrs3d));
          }
-         else
-           if (VISU::ScalarMap_i* aPrs = dynamic_cast<VISU::ScalarMap_i*>(myFieldsLst[i].myPrs[aFrameId]))
-             aPrs->SetRange(aMin, aMax);
+       }
+
+       double aMin = getMinFieldsValue(myFieldsLst);
+       double aMax = getMaxFieldsValue(myFieldsLst);
+
+       for (int aFieldId = 0; aFieldId < getNbFields(); aFieldId++) {
+         FieldData& aFieldData = getFieldData(aFieldId);
+         for (long aFrameId = 0; aFrameId < aFieldData.myNbFrames; aFrameId++) {
+           VISU::ColoredPrs3d_i* aPrs3d = aFieldData.myPrs[aFrameId];
+           aPrs3d->SetMinMaxController(aMinMaxController);
+           if (VISU::IsoSurfaces_i* anIsoSurfaces = dynamic_cast<VISU::IsoSurfaces_i*>(aPrs3d))
+             anIsoSurfaces->SetSubRange(aMin, aMax);
+         }
+       }
+      }
     }
   }
 }
@@ -580,7 +635,7 @@ CORBA::Boolean VISU_TimeAnimation::_generateFrames() {
        aData.myPrs[j]->SetOffset(aData.myOffset);
        aActor = aData.myPrs[j]->CreateActor();
        myView->AddActor(aActor);
-       bool condition = ( myAnimationMode == 0 ) ? (j == 0) : (j == 0 && i == 0);
+       bool condition = ( myAnimationMode == VISU::Animation::PARALLEL ) ? (j == 0) : (j == 0 && i == 0);
        if(condition)
          aActor->VisibilityOn();
        else
@@ -711,7 +766,7 @@ void VISU_TimeAnimation::_nextFrame() {
     int aFieldId;
     long aFrameId;
 
-    if ( myAnimationMode == 0 ) { // parallel animation mode
+    if ( myAnimationMode == VISU::Animation::PARALLEL ) { // parallel animation mode
       for (i = 0; i < getNbFields(); i++)
        if (myFieldsLst[i].myActors[myFrame] != 0)
          visibilityOff(i, myFrame);
@@ -726,7 +781,7 @@ void VISU_TimeAnimation::_nextFrame() {
 
     myFrame++;
 
-    if ( myAnimationMode == 0 ) { // parallel animation mode
+    if ( myAnimationMode == VISU::Animation::PARALLEL ) { // parallel animation mode
       for (i = 0; i < getNbFields(); i++)
        if (myFieldsLst[i].myActors[myFrame] != 0)
          myFieldsLst[i].myActors[myFrame]->VisibilityOn();
@@ -768,7 +823,7 @@ void VISU_TimeAnimation::_prevFrame() {
     int aFieldId;
     long aFrameId;
 
-    if ( myAnimationMode == 0 ) { // parallel animation mode
+    if ( myAnimationMode == VISU::Animation::PARALLEL ) { // parallel animation mode
       for (i = 0; i < getNbFields(); i++)
        if (myFieldsLst[i].myActors[myFrame] != 0)
          visibilityOff(i, myFrame);
@@ -783,7 +838,7 @@ void VISU_TimeAnimation::_prevFrame() {
 
     myFrame--;
 
-    if ( myAnimationMode == 0 ) { // parallel animation mode
+    if ( myAnimationMode == VISU::Animation::PARALLEL ) { // parallel animation mode
       for (i = 0; i < getNbFields(); i++)
        if (myFieldsLst[i].myActors[myFrame] != 0)
          myFieldsLst[i].myActors[myFrame]->VisibilityOn();
@@ -820,7 +875,7 @@ void VISU_TimeAnimation::_firstFrame() {
   }
   stopAnimation();
   int i;
-  if ( myAnimationMode == 0 ) { // parallel animation mode
+  if ( myAnimationMode == VISU::Animation::PARALLEL ) { // parallel animation mode
     for (i = 0; i < getNbFields(); i++)
       if(!myFieldsLst[i].myActors.empty())
        if (myFieldsLst[i].myActors[myFrame] != 0)
@@ -837,7 +892,7 @@ void VISU_TimeAnimation::_firstFrame() {
   myFrame = 0;
 
   int imax;
-  if ( myAnimationMode == 0 ) // parallel animation mode 
+  if ( myAnimationMode == VISU::Animation::PARALLEL ) // parallel animation mode 
     imax = getNbFields();
   else //succcessive animation mode
     imax = 1;
@@ -873,7 +928,7 @@ void VISU_TimeAnimation::_lastFrame() {
   int aFieldId;
   long aFrameId;
 
-  if ( myAnimationMode == 0 ) { // parallel animation mode
+  if ( myAnimationMode == VISU::Animation::PARALLEL ) { // parallel animation mode
     for (i = 0; i < getNbFields(); i++)
       if (myFieldsLst[i].myActors[myFrame] != 0)
        visibilityOff(i, myFrame);
@@ -888,7 +943,7 @@ void VISU_TimeAnimation::_lastFrame() {
 
   myFrame = getNbFrames() - 1; //myFieldsLst[0].myNbFrames-1;
 
-  if ( myAnimationMode == 0 ) { // parallel animation mode
+  if ( myAnimationMode == VISU::Animation::PARALLEL ) { // parallel animation mode
     for (i = 0; i < getNbFields(); i++)
       if (myFieldsLst[i].myActors[myFrame] != 0)
        myFieldsLst[i].myActors[myFrame]->VisibilityOn();
@@ -933,7 +988,7 @@ void VISU_TimeAnimation::_gotoFrame(CORBA::Long theFrame) {
   int aFieldId;
   long aFrameId;
   
-  if ( myAnimationMode == 0 ) { // parallel animation mode
+  if ( myAnimationMode == VISU::Animation::PARALLEL ) { // parallel animation mode
     for (i = 0; i < getNbFields(); i++)
       if (myFieldsLst[i].myActors[myFrame] != 0)
        visibilityOff(i, myFrame);
@@ -948,7 +1003,7 @@ void VISU_TimeAnimation::_gotoFrame(CORBA::Long theFrame) {
 
   myFrame = theFrame;
 
-  if ( myAnimationMode == 0 ) { // parallel animation mode
+  if ( myAnimationMode == VISU::Animation::PARALLEL ) { // parallel animation mode
     for (i = 0; i < getNbFields(); i++)
       if (myFieldsLst[i].myActors[myFrame] != 0)
        myFieldsLst[i].myActors[myFrame]->VisibilityOn();
@@ -1001,7 +1056,7 @@ VISU::ColoredPrs3d_ptr VISU_TimeAnimation::getPresentation(CORBA::Long theField,
 
 //------------------------------------------------------------------------
 CORBA::Long VISU_TimeAnimation::getNbFrames() {
-  if ( myAnimationMode == 0 ) // parallel animation mode
+  if ( myAnimationMode == VISU::Animation::PARALLEL ) // parallel animation mode
     return (getNbFields() > 0)? myFieldsLst[0].myNbFrames : 0;
   else //succcessive animation mode
     return (getNbFields() > 0 && !myFieldsAbsFrames.empty()) ? myFieldsAbsFrames[myFieldsAbsFrames.size()-1] : 0;
@@ -1014,7 +1069,7 @@ long VISU_TimeAnimation::getAbsoluteFrameNumber(std::pair<int,long> theFieldTime
   if ( getNbFields() > 0 ) {
     int aFieldId = theFieldTimeStamp.first;
     long aFrameNum = theFieldTimeStamp.second + 1;
-    if ( myAnimationMode == 0 ) { // parallel animation mode
+    if ( myAnimationMode == VISU::Animation::PARALLEL ) { // parallel animation mode
       if ( aFrameNum <= myFieldsAbsFrames[0] )
         aRes = aFrameNum;
     }
@@ -1034,7 +1089,7 @@ std::pair<int,long> VISU_TimeAnimation::getRelativeFrameNumber(long theFrame)
   std::pair<int,long> aRes;
   if ( getNbFields() > 0 && theFrame < getNbFrames() ) {
     theFrame = theFrame + 1;
-    if ( myAnimationMode == 0 ) { // parallel animation mode
+    if ( myAnimationMode == VISU::Animation::PARALLEL ) { // parallel animation mode
       aRes.first = 0;
       aRes.second = theFrame - 1;
     }
@@ -1262,7 +1317,7 @@ void VISU_TimeAnimation::saveImages( int theFieldId,
     QString aFile(myDumpPath);
 
     QString aName;
-    if ( myAnimationMode == 0 ) // parallel animation mode
+    if ( myAnimationMode == VISU::Animation::PARALLEL ) // parallel animation mode
       aName = QString("%1").arg(myFieldsLst[theFieldId].myTiming[myFrame]);
     else // successive animation mode
       aName = QString("%1").arg(myFieldsLst[theFieldId].myTiming[getRelativeFrameNumber(myFrame).second]);
@@ -1334,7 +1389,7 @@ void VISU_TimeAnimation::run()
   myFileIndex = 0;
   QValueList<int> anIndexList;
 
-  if ( myAnimationMode == 0 ) // parallel animation mode
+  if ( myAnimationMode == VISU::Animation::PARALLEL ) // parallel animation mode
     parallelAnimation( isDumping, anIndexList );
   else //succcessive animation mode
     succcessiveAnimation( isDumping, anIndexList );
@@ -1521,28 +1576,40 @@ SALOMEDS::SObject_ptr VISU_TimeAnimation::publishInStudy()
                   myTimeMaxVal,
                   myAnimationMode);
 
-  string anEntry = VISU::CreateAttributes(myStudy,aSComponentEntry.c_str(),"","",
-                                          GenerateName(),"",aComment,true);
+  string anEntry = VISU::CreateAttributes(myStudy,
+                                         aSComponentEntry.c_str(),
+                                         VISU::NO_ICON,
+                                         VISU::NO_IOR,
+                                          GenerateName(),
+                                         VISU::NO_PERFSITENT_REF,
+                                         aComment,
+                                         true);
   myAnimEntry = anEntry.c_str();
   _PTR(SObject) aAnimSObject = myStudy->FindObjectID(anEntry.c_str());
 
   for (int i = 0; i < getNbFields(); i++) {
     FieldData& aData = myFieldsLst[i];
-    if ( aData.myPrs.front() ) {
+    if (aData.myPrs.empty()) {
+      generatePresentations(i);
+    }
+    if ( !aData.myPrs.empty() ) {
       _PTR(SObject) newObj = aStudyBuilder->NewObject(aAnimSObject);
       aStudyBuilder->Addreference(newObj, aData.myField);
       
-      if (aData.myPrs.empty()) {
-       generatePresentations(i);
-      }
       ostringstream strOut;
       aData.myPrs[0]->ToStream(strOut);
       string aPrsComment = strOut.str();
       string aPrsMyComment = aData.myPrs[0]->GetComment();
       if(aPrsMyComment == "PRSMERGER")
        aPrsMyComment = "SCALARMAP";
-      VISU::CreateAttributes(myStudy, newObj->GetID().c_str(),"","",
-                            aPrsMyComment.c_str(),"",aPrsComment.c_str(),true);
+      VISU::CreateAttributes(myStudy, 
+                            newObj->GetID().c_str(),
+                            VISU::NO_ICON,
+                            VISU::NO_IOR,
+                            aPrsMyComment.c_str(),
+                            VISU::NO_PERFSITENT_REF,
+                            aPrsComment.c_str(),
+                            true);
     }
   }
   aStudyBuilder->CommitCommand();
@@ -1607,8 +1674,14 @@ void VISU_TimeAnimation::saveAnimation()
       aPrsName->SetValue(aPrsNameTxt);
 
     } else {
-      VISU::CreateAttributes(myStudy, aRefObj->GetID().c_str(),"","",
-                             aPrsNameTxt.c_str(),"",aPrsComment.c_str(),true);
+      VISU::CreateAttributes(myStudy, 
+                            aRefObj->GetID().c_str(),
+                            VISU::NO_ICON,
+                            VISU::NO_IOR,
+                             aPrsNameTxt.c_str(),
+                            VISU::NO_PERFSITENT_REF,
+                            aPrsComment.c_str(),
+                            true);
     }
   }
   aStudyBuilder->CommitCommand();
@@ -1632,7 +1705,7 @@ void VISU_TimeAnimation::restoreFromStudy(_PTR(SObject) theField)
   bool isExist;
   myTimeMinVal = VISU::Storable::FindValue(aMap,"myTimeMinVal",&isExist).toDouble();
   myTimeMaxVal = VISU::Storable::FindValue(aMap,"myTimeMaxVal",&isExist).toDouble();
-  myAnimationMode = VISU::Storable::FindValue(aMap,"myMode",&isExist).toInt();
+  myAnimationMode = VISU::Animation::AnimationMode(VISU::Storable::FindValue(aMap,"myMode",&isExist).toInt());
 
   _PTR(ChildIterator) anIter = myStudy->NewChildIterator(aAnimSObject);
   for (anIter->Init(); anIter->More(); anIter->Next()) {
@@ -1695,8 +1768,7 @@ void VISU_TimeAnimation::restoreFromStudy(_PTR(SObject) theField)
        if (VISU::ScalarMap_i* aPrs = dynamic_cast<VISU::ScalarMap_i*>(aData.myPrs[i]))
          anIsFixedRange = aPrs->IsRangeFixed();
       }
-      //jfa 03.08.2005:aData.myPrs[i]->SameAs(aData.myPrs[0]);
-      aData.myPrs[i]->SameAs(aData.myPrs[0]);//jfa 03.08.2005
+      aData.myPrs[i]->SameAs(aData.myPrs[0]);
     }
   }
   string aStr = aAnimSObject->GetID();
@@ -1716,7 +1788,7 @@ void VISU_TimeAnimation::ApplyProperties(CORBA::Long theFieldNum, VISU::ColoredP
   if ( !aPrs_i ) 
     throw SALOME_Exception(LOCALIZED("Error : invalid dynamic cast of the given presentation to VISU::ColoredPrs3d_i"));
   
-  if ( myAnimationMode == 0 ) { // parallel animation mode
+  if ( myAnimationMode == VISU::Animation::PARALLEL ) { // parallel animation mode
     FieldData& aData = myFieldsLst[theFieldNum];
     
     if ( aData.myPrs.empty() )
@@ -1734,7 +1806,7 @@ void VISU_TimeAnimation::ApplyProperties(CORBA::Long theFieldNum, VISU::ColoredP
       aData.myPrs[i]->SameAs(aPrs_i);
     }
   }
-  else if ( myAnimationMode == 1 ) { // successive animation mode
+  else if ( myAnimationMode == VISU::Animation::SUCCESSIVE ) { // successive animation mode
     for (int f = 0; f < getNbFields(); f++) {
       FieldData& aData = myFieldsLst[f];
       
index 3ee70f4cc82b35f6a9d85724349a11905a17affe..c32552a0b302bc189f76b6f34963a7a9bada11f8 100644 (file)
@@ -162,8 +162,8 @@ class VISU_I_EXPORT VISU_TimeAnimation: public QObject, public QThread
   void saveAnimation();
   bool isSavedInStudy() const { return !myAnimEntry.isEmpty(); }
 
-  void setAnimationMode(int theMode) { myAnimationMode = theMode; }
-  int  getAnimationMode() { return myAnimationMode; }
+  void setAnimationMode(VISU::Animation::AnimationMode theMode) { myAnimationMode = theMode; }
+  VISU::Animation::AnimationMode  getAnimationMode() { return myAnimationMode; }
 
   void ApplyProperties(CORBA::Long theFieldNum, VISU::ColoredPrs3d_ptr thePrs) throw (SALOME::SALOME_Exception);
 
@@ -196,7 +196,7 @@ class VISU_I_EXPORT VISU_TimeAnimation: public QObject, public QThread
   bool myCleaningMemoryAtEachFrame;
   _PTR(Study) myStudy;
 
-  int myAnimationMode;
+  VISU::Animation::AnimationMode myAnimationMode;
   double myTimeMinVal, myTimeMaxVal; //!< Range of time stams, set by user
   double myTimeMin   , myTimeMax   ; //!< Range of time stams, available for animation
   QString myDumpPath;