Salome HOME
Fix for Bug IPAL8945
[modules/visu.git] / src / VISUGUI / VisuGUI_TimeAnimation.h
index 9ae881e76ff8a44afebf1815b2c952c78b194c65..53191604996c1c1bcef7932a7b47877367954435 100644 (file)
 #ifndef VISUGUI_TIMEANIMATION_H
 #define VISUGUI_TIMEANIMATION_H
 
-#include <qdialog.h>
-#include <qslider.h>
-#include <qcombobox.h>
-#include <qtoolbutton.h>
-#include <qevent.h>
+#include "QtxDblSpinBox.h"
+
+#include "SALOMEDSClient_Study.hxx"
 
-#include "VisuGUI_ScalarBarDlg.h"
+#include <qdialog.h>
+#include <qbuttongroup.h>
+#include <qwidgetstack.h>
 
+class VisuGUI;
 class VISU_TimeAnimation;
 
+namespace VISU {
+  class Prs3d_i;
+}
+
+class SVTK_ViewWindow;
+
+class QtxDblSpinBox;
 
-/**
+class QLabel;
+class QSlider;
+class QListBox;
+class QCheckBox;
+class QComboBox;
+class QToolButton;
+
+/*!
  * Auxilliary class for presentations definition
  */
+class ArrangeDlg: public QDialog
+{
+  Q_OBJECT
+ public:
+  enum { AutoMode, ManualMode };
+  enum { XAxis, YAxis, ZAxis };
+
+  ArrangeDlg(QWidget* theParent, VISU_TimeAnimation* theAnimator);
+  ArrangeDlg(QWidget* theParent, SVTK_ViewWindow* theViewWindow);
+  ~ArrangeDlg() {};
+
+  int getMode() const { return  myStackWgt->id(myStackWgt->visibleWidget()); }
+  double getDistance() const { return myDistVal->value(); }
+  int getAxis() const { return myAxisGrp->id(myAxisGrp->selected()); }
+
+ protected slots:
+  virtual void accept();
+  void onFieldChange(int);
+
+ private:
+  struct Offset {
+    float myOffset[3];
+  };
+
+
+  void init();
+  void acceptAnimation();
+  void acceptViewWindow();
+
+  VISU_TimeAnimation* myAnimator;
+  SVTK_ViewWindow   * myViewWindow;
+
+  QWidgetStack*       myStackWgt;
+  QButtonGroup*       myAxisGrp;
+  QtxDblSpinBox*      myDistVal;
+  QListBox*           myFieldLst;
+  QtxDblSpinBox*      myCoord[3];
+  QValueList<Offset>  myOffsets;
+
+  QCheckBox*          mySaveChk;
+
+  int               myCurrent;
+  QMap<VISU::Prs3d_i*, int> myPrsMap;
+};
+
+
 class SetupDlg: public QDialog {
   Q_OBJECT
 
-public:
-  SetupDlg(QWidget* theParent, VISU_TimeAnimation* theAnimator);
+ public:
+  SetupDlg(QWidget* theParent,
+          VisuGUI* theModule, 
+          VISU_TimeAnimation* theAnimator);
   ~SetupDlg() {};
-  
-private slots:
+
+ private slots:
   void onFieldChange(int theIndex);
-  void onTypeChanged(int theIndex); 
-  void onScalarBarDlg();
+  void onTypeChanged(int theIndex);
+  //  void onScalarBarDlg();
   void onPreferencesDlg();
   void onRangeCheck(bool theCheck);
   void onMinValue(double theVal);
   void onMaxValue(double theVal);
+  void onArrangeDlg();
 
-private:
+ private:
+  VisuGUI* myModule;
   VISU_TimeAnimation* myAnimator;
+
   QListBox* myFieldLst;
   QComboBox* myTypeCombo;
+  std::vector<int> myComboId2TypeId;
+  std::map<int,int> myTypeId2ComboId;
+
   QPushButton* myPropBtn;
+  QPushButton* myArrangeBtn;
   QCheckBox* myUseRangeChk;
-  QAD_SpinBoxDbl* myMinVal;
-  QAD_SpinBoxDbl* myMaxVal;
+  QtxDblSpinBox* myMinVal;
+  QtxDblSpinBox* myMaxVal;
 };
 
 
-
 class VisuGUI_TimeAnimationDlg: public QDialog
-{ 
+{
     Q_OBJECT
  public:
-    VisuGUI_TimeAnimationDlg(SALOMEDS::Study_var theStudy);
+    VisuGUI_TimeAnimationDlg(VisuGUI* theModule, _PTR(Study) theStudy);
     ~VisuGUI_TimeAnimationDlg();
 
-    void addField(SALOMEDS::SObject_var theField);
+    void addField(_PTR(SObject) theField);
     void clearView();
 
+    void restoreFromStudy(_PTR(SObject) theAnimation);
+
  protected:
     virtual void closeEvent(QCloseEvent* theEvent);
+    virtual void showEvent(QShowEvent* theEvent);
     void stopAnimation();
 
  private slots:
@@ -75,12 +147,14 @@ class VisuGUI_TimeAnimationDlg: public QDialog
    void onLastPressed();
    void onFirstPressed();
    void onSetupDlg();
-   void onFrameChanged(int index);
+   void onWindowChanged(int index);
    void createFrames();
    void onSpeedChange(double theSpeed);
    void onExecution(long theNewFrame, double theTime);
    void onBrowse();
    void onStop();
+   void saveToStudy();
+   void publishToStudy();
 
  private:
     QSlider* mySlider;
@@ -92,12 +166,19 @@ class VisuGUI_TimeAnimationDlg: public QDialog
     QPushButton* myGenBtn;
 
     QFrame* myPlayFrame;
-    SALOMEDS::Study_var myStudy;
+    SetupDlg* mySetupDlg;
+    _PTR(Study) myStudy;
+    VisuGUI* myModule;
 
     VISU_TimeAnimation* myAnimator;
     QCheckBox* mySaveCheck;
+    QComboBox* myPicsFormat;
     QLineEdit* myPathEdit;
     bool isClosing;
     QCloseEvent* myEvent;
+
+    QPushButton* myPublishBtn;
+    QPushButton* mySaveBtn;
 };
+
 #endif  //VISUGUI_TIMEANIMATION_H