1 // VISU VISUGUI : GUI of VISU component
3 // Copyright (C) 2003 CEA/DEN, EDF R&D
7 // File : VisuGUI_TimeAnimation.cxx
8 // Author : Vitaly SMETANNIKOV
11 #include "VisuGUI_TimeAnimation.h"
14 #include "VisuGUI_Tools.h"
15 #include "VisuGUI_DeformedShapeDlg.h"
16 #include "VisuGUI_CutPlanesDlg.h"
17 #include "VisuGUI_VectorsDlg.h"
18 #include "VisuGUI_IsoSurfacesDlg.h"
19 #include "VisuGUI_StreamLinesDlg.h"
21 #include "VISU_TimeAnimation.h"
23 #include "VISU_ScalarMap_i.hh"
24 #include "VISU_IsoSurfaces_i.hh"
25 #include "VISU_DeformedShape_i.hh"
26 #include "VISU_CutPlanes_i.hh"
27 #include "VISU_CutLines_i.hh"
28 #include "VISU_Vectors_i.hh"
29 #include "VISU_StreamLines_i.hh"
31 #include "VISU_ScalarBarActor.hxx"
33 #include "SalomeApp_Application.h"
35 #include "SUIT_OverrideCursor.h"
36 #include "SUIT_MessageBox.h"
37 #include "SUIT_Desktop.h"
38 #include "SUIT_FileDlg.h"
42 #include <qhgroupbox.h>
43 #include <qwt_wheel.h>
44 #include <qlcdnumber.h>
46 #include <qvgroupbox.h>
49 //static double MAXVALUE = 1.0E+300;
52 SetupDlg::SetupDlg (QWidget* theParent, VISU_TimeAnimation* theAnimator)
53 : QDialog(theParent, "SetupDlg", true, WStyle_Customize |
54 WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu)
56 setCaption("Setup Animation");
57 setSizeGripEnabled( TRUE );
58 myAnimator = theAnimator;
60 QVBoxLayout* aMainLayout = new QVBoxLayout(this, 7, 6);
61 aMainLayout->setSpacing(5);
64 QFrame* aRangeGrp = new QFrame(this);
65 QGridLayout* aRangeLayout = new QGridLayout( aRangeGrp );
66 aRangeLayout->setSpacing( 6 );
67 aRangeLayout->setMargin( 11 );
68 aRangeGrp->setFrameStyle(QFrame::Box | QFrame::Raised);
70 myUseRangeChk = new QCheckBox("Use range of time stamps", aRangeGrp);
71 aRangeLayout->addMultiCellWidget(myUseRangeChk, 0, 0, 0, 3);
72 myUseRangeChk->setChecked(myAnimator->isRangeDefined());
74 QLabel* aMinLbl = new QLabel("From", aRangeGrp);
75 aMinLbl->setEnabled(myUseRangeChk->isChecked());
76 aRangeLayout->addWidget(aMinLbl, 1, 0);
77 double aStep = (myAnimator->getMaxTime() - myAnimator->getMinTime())/(theAnimator->getFieldData(0).myNbTimes - 1);
78 myMinVal = new QtxDblSpinBox( myAnimator->getMinTime(), myAnimator->getMaxTime(), aStep, aRangeGrp );
79 myMinVal->setEnabled(myUseRangeChk->isChecked());
80 if (myUseRangeChk->isChecked())
81 myMinVal->setValue( myAnimator->getMinRange() );
83 myMinVal->setValue( myAnimator->getMinTime() );
85 connect(myMinVal, SIGNAL( valueChanged(double)),
86 this, SLOT( onMinValue(double) ));
87 aRangeLayout->addWidget(myMinVal, 1, 1);
89 QLabel* aMaxLbl = new QLabel("To", aRangeGrp);
90 aMaxLbl->setEnabled(myUseRangeChk->isChecked());
91 aRangeLayout->addWidget(aMaxLbl, 1, 2);
92 myMaxVal = new QtxDblSpinBox( myAnimator->getMinTime(), myAnimator->getMaxTime(), aStep, aRangeGrp );
93 myMaxVal->setEnabled(myUseRangeChk->isChecked());
94 if (myUseRangeChk->isChecked())
95 myMaxVal->setValue( myAnimator->getMaxRange() );
97 myMaxVal->setValue( myAnimator->getMaxTime() );
99 connect(myMaxVal, SIGNAL( valueChanged(double)),
100 this, SLOT( onMaxValue(double) ));
101 aRangeLayout->addWidget(myMaxVal, 1, 3);
103 connect(myUseRangeChk, SIGNAL( toggled(bool)),
104 aMinLbl, SLOT( setEnabled(bool) ));
105 connect(myUseRangeChk, SIGNAL( toggled(bool)),
106 aMaxLbl, SLOT( setEnabled(bool) ));
107 connect(myUseRangeChk, SIGNAL( toggled(bool)),
108 this, SLOT( onRangeCheck(bool) ));
110 aMainLayout->addWidget(aRangeGrp);
113 QHBox* aPropFrame = new QHBox(this);
114 aPropFrame->setSpacing(5);
116 QVGroupBox* aNamesBox = new QVGroupBox("Fields",aPropFrame);
117 myFieldLst = new QListBox(aNamesBox);
118 QStringList aFieldNames;
119 // Find names of fields
120 for (int i = 0; i < theAnimator->getNbFields(); i++) {
121 _PTR(SObject) aSO = theAnimator->getFieldData(i).myField;
122 aFieldNames.append(VISU::getValue(aSO, "myName"));
124 myFieldLst->insertStringList(aFieldNames);
125 myFieldLst->setSelected(0, true);
126 connect( myFieldLst, SIGNAL( highlighted(int) ),
127 this, SLOT( onFieldChange(int) ) );
130 QVGroupBox* aPropBox = new QVGroupBox("Properties", aPropFrame);
131 myTypeCombo = new QComboBox(aPropBox);
132 connect( myTypeCombo, SIGNAL( activated(int) ),
133 this, SLOT( onTypeChanged(int) ) );
135 // QPushButton* aBarBtn = new QPushButton("Scalar Bar...", aPropBox);
136 //connect( aBarBtn, SIGNAL( clicked() ),
137 // this, SLOT( onScalarBarDlg() ) );
139 myPropBtn = new QPushButton("Properties...", aPropBox);
140 // myPropBtn->setEnabled(theAnimator->getFieldData(0).myPrsType != VISU::TSCALARMAP);
141 connect( myPropBtn, SIGNAL( clicked() ),
142 this, SLOT( onPreferencesDlg() ) );
145 aMainLayout->addWidget(aPropFrame);
147 QHBox* aBtnBox = new QHBox(this);
148 QHBoxLayout* aBtnLayout = new QHBoxLayout(aBtnBox->layout());
149 aBtnLayout->addStretch();
151 QPushButton* aCloseBtn = new QPushButton(tr("BUT_OK"), aBtnBox);
152 connect(aCloseBtn, SIGNAL(clicked()), this, SLOT(close()));
154 aMainLayout->addWidget(aBtnBox);
157 //************************************************************************
158 void SetupDlg::onFieldChange (int theIndex)
160 FieldData& aData = myAnimator->getFieldData(theIndex);
161 myTypeCombo->clear();
162 myTypeCombo->insertItem("Scalar Map");
163 myTypeCombo->insertItem("Iso Surfaces");
164 myTypeCombo->insertItem("Cut Planes");
166 _PTR(SObject) aSObject = aData.myField;
167 long aNumComp = VISU::getValue(aSObject, "myNumComponent").toLong();
169 myTypeCombo->insertItem("Deformed Shape");
170 myTypeCombo->insertItem("Vectors");
171 myTypeCombo->insertItem("Stream Lines");
173 switch (aData.myPrsType) {
174 case VISU::TSCALARMAP: //Scalar Map
175 myTypeCombo->setCurrentItem(0);
177 case VISU::TISOSURFACE: //Iso Surfaces
178 myTypeCombo->setCurrentItem(1);
180 case VISU::TCUTPLANES: //Cut Planes
181 myTypeCombo->setCurrentItem(2);
183 case VISU::TDEFORMEDSHAPE: //Deformed Shape
184 myTypeCombo->setCurrentItem(3);
186 case VISU::TVECTORS: //Vectors
187 myTypeCombo->setCurrentItem(4);
189 case VISU::TSTREAMLINES: //Stream Lines
190 myTypeCombo->setCurrentItem(5);
191 aData.myPrsType = VISU::TSTREAMLINES;
194 //myPropBtn->setEnabled(aData.myPrsType != VISU::TSCALARMAP);
197 //************************************************************************
198 void SetupDlg::onTypeChanged (int theIndex)
200 FieldData& aData = myAnimator->getFieldData(myFieldLst->currentItem());
203 aData.myPrsType = VISU::TSCALARMAP;
205 case 1: //Iso Surfaces
206 aData.myPrsType = VISU::TISOSURFACE;
209 aData.myPrsType = VISU::TCUTPLANES;
211 case 3: //Deformed Shape
212 aData.myPrsType = VISU::TDEFORMEDSHAPE;
215 aData.myPrsType = VISU::TVECTORS;
217 case 5: //Stream Lines
218 aData.myPrsType = VISU::TSTREAMLINES;
221 myAnimator->clearData(aData);
222 //myPropBtn->setEnabled(aData.myPrsType != VISU::TSCALARMAP);
223 //myAnimator->generatePresentations(myFieldLst->currentItem());
226 //************************************************************************
227 /*void SetupDlg::onScalarBarDlg() {
228 QApplication::setOverrideCursor( Qt::waitCursor );
229 FieldData& aData = myAnimator->getFieldData(myFieldLst->currentItem());
230 if (aData.myPrs == 0)
231 myAnimator->generatePresentations(myFieldLst->currentItem());
232 QApplication::restoreOverrideCursor();
234 VisuGUI_ScalarBarDlg* aScalarBarDlg = new VisuGUI_ScalarBarDlg();
235 aScalarBarDlg->initFromPrsObject(aData.myPrs[0]);
236 if (aScalarBarDlg->exec()) {
237 for (int i = 0; i < aData.myNbFrames; i++)
238 aScalarBarDlg->storeToPrsObject(aData.myPrs[i]);
243 //************************************************************************
244 void SetupDlg::onPreferencesDlg()
246 MESSAGE("SetupDlg::onPreferencesDlg() is not implemented");
247 /* SUIT_OverrideCursor c;
248 FieldData& aData = myAnimator->getFieldData(myFieldLst->currentItem());
249 if (aData.myPrs.empty())
250 myAnimator->generatePresentations(myFieldLst->currentItem());
252 // BUG VISU5725 : Compatibility gcc 2.95
253 // #define EDITPRS(TYPE, DLG) \
255 // DLG* aDlg = new DLG(); \
256 // aDlg->initFromPrsObject(dynamic_cast<TYPE*>(aData.myPrs.at(0))); \
257 // if (aDlg->exec()) { \
258 // for (int i = 0; i < aData.myNbFrames; i++) \
259 // aDlg->storeToPrsObject(dynamic_cast<TYPE*>(aData.myPrs.at(i))); \
265 #define EDITPRS(TYPE, DLG) {DLG* aDlg = new DLG(); aDlg->initFromPrsObject(dynamic_cast<TYPE*>(aData.myPrs[0])); if (aDlg->exec()) { for (int i = 0; i < aData.myNbFrames; i++) aDlg->storeToPrsObject(dynamic_cast<TYPE*>(aData.myPrs[i])); } delete aDlg;}
267 switch (myTypeCombo->currentItem()) {
269 EDITPRS(VISU::ScalarMap_i, VisuGUI_ScalarBarDlg);
271 case 1: //Iso Surfaces
272 EDITPRS(VISU::IsoSurfaces_i, VisuGUI_IsoSurfacesDlg);
275 // EDITPRS(VISU::CutPlanes_i, VisuGUI_CutPlanesDlg);
277 VisuGUI_CutPlanesDlg* aDlg = new VisuGUI_CutPlanesDlg(false, true);
278 //_CS_PhB :operator [] .at aDlg->initFromPrsObject(dynamic_cast<VISU::CutPlanes_i*>(aData.myPrs.at(0)));
279 aDlg->initFromPrsObject(dynamic_cast<VISU::CutPlanes_i*>(aData.myPrs[0]));
282 for (int i = 0; i < aData.myNbFrames; i++)
283 //_CS_PhB:operator [] .at aDlg->storeToPrsObject(dynamic_cast<VISU::CutPlanes_i*>(aData.myPrs.at(i)));
284 aDlg->storeToPrsObject(dynamic_cast<VISU::CutPlanes_i*>(aData.myPrs[i]));
289 case 3: //Deformed Shape
290 EDITPRS(VISU::DeformedShape_i, VisuGUI_DeformedShapeDlg);
293 EDITPRS(VISU::Vectors_i, VisuGUI_VectorsDlg);
295 case 5: //Stream Lines
296 EDITPRS(VISU::StreamLines_i, VisuGUI_StreamLinesDlg);
303 //************************************************************************
304 void SetupDlg::onRangeCheck (bool theCheck)
306 for (int i = 0; i < myAnimator->getNbFields(); i++)
307 myAnimator->clearData(myAnimator->getFieldData(i));
309 myMinVal->setEnabled(theCheck);
310 myMaxVal->setEnabled(theCheck);
313 myAnimator->setAnimationRange(0, 0);
315 // if (myMinVal->value() < myMaxVal->value())
316 myAnimator->setAnimationRange(myMinVal->value(), myMaxVal->value());
317 // else if (myMinVal->value() > myMaxVal->value())
318 // myAnimator->setAnimationRange(myMaxVal->value(), myMinVal->value());
319 // else // equal case
320 // myAnimator->setAnimationRange(0, 0);
324 //************************************************************************
325 void SetupDlg::onMinValue (double theVal)
327 if (theVal > myAnimator->getMaxRange()) {
328 myMinVal->setValue( myAnimator->getMinTime() );
329 myMinVal->setFocus();
332 for (int i = 0; i < myAnimator->getNbFields(); i++)
333 myAnimator->clearData(myAnimator->getFieldData(i));
334 myAnimator->setAnimationRange(theVal, myAnimator->getMaxRange());
337 //************************************************************************
338 void SetupDlg::onMaxValue (double theVal)
340 if (theVal < myAnimator->getMinRange()) {
341 myMaxVal->setValue( myAnimator->getMaxTime() );
342 myMaxVal->setFocus();
345 for (int i = 0; i < myAnimator->getNbFields(); i++)
346 myAnimator->clearData(myAnimator->getFieldData(i));
347 myAnimator->setAnimationRange(myAnimator->getMinRange(), theVal);
350 static const char * firstIco[] = {
366 static const char * lastIco[] = {
382 static const char * leftIco[] = {
397 static const char * playIco[] = {
416 static QPixmap MYplayPixmap(playIco);
419 static const char * rightIco[] = {
435 static const char * pauseIco[] = {
454 static QPixmap MYpausePixmap(pauseIco);
457 VisuGUI_TimeAnimationDlg::VisuGUI_TimeAnimationDlg (QWidget* parent, _PTR(Study) theStudy)
458 : QDialog(parent, "VisuGUI_TimeAnimationDlg", false, WStyle_Customize |
459 WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu | WDestructiveClose)
461 setCaption("Animation");
462 setSizeGripEnabled( TRUE );
466 //myAnimator = new VISU_TimeAnimation (VISU::GetDSStudy(theStudy));
467 myAnimator = new VISU_TimeAnimation (theStudy);
468 myAnimator->setSpeed(1);
469 myAnimator->setViewer(VISU::GetViewWindow());
470 connect(myAnimator, SIGNAL(frameChanged(long, double)), this, SLOT(onExecution(long, double)));
471 connect(myAnimator, SIGNAL(stopped()), this, SLOT(onStop()));
473 QVBoxLayout* aMainLayout = new QVBoxLayout(this, 7, 6);
474 aMainLayout->setSpacing(5);
476 mySetupBtn = new QPushButton("Setup Animation...", this);
477 connect( mySetupBtn, SIGNAL( clicked() ),
478 this, SLOT( onSetupDlg() ) );
479 aMainLayout->addWidget(mySetupBtn);
481 myGenBtn = new QPushButton("Generate frames", this);
482 connect( myGenBtn, SIGNAL( clicked() ),
483 this, SLOT( createFrames() ) );
484 aMainLayout->addWidget(myGenBtn);
486 myPlayFrame = new QFrame(this);
487 myPlayFrame->setFrameStyle(QFrame::WinPanel | QFrame::Sunken);
488 myPlayFrame->setLineWidth( 1 );
491 // --- Play controls ---
492 QGridLayout* TopLayout = new QGridLayout( myPlayFrame );
493 TopLayout->setSpacing( 6 );
494 TopLayout->setMargin( 11 );
496 myTimeLbl = new QLabel("0", myPlayFrame);
497 TopLayout->addMultiCellWidget(myTimeLbl, 0, 0, 0, 2, Qt::AlignHCenter);
499 mySlider = new QSlider(Qt::Horizontal, myPlayFrame);
500 mySlider->setMinValue(0);
501 mySlider->setMaxValue(3);
502 mySlider->setTickInterval(1);
503 //mySlider->setTickmarks(QSlider::Below);
504 mySlider->setTracking(false);
505 connect( mySlider, SIGNAL( valueChanged(int) ),
506 this, SLOT( onWindowChanged(int) ) );
507 TopLayout->addMultiCellWidget(mySlider, 1, 1, 0, 2);
509 myPlayBtn = new QToolButton(myPlayFrame);
510 myPlayBtn->setIconSet(MYplayPixmap);
511 myPlayBtn->setToggleButton(true);
512 connect( myPlayBtn, SIGNAL( clicked() ),
513 this, SLOT( onPlayPressed() ) );
514 TopLayout->addMultiCellWidget(myPlayBtn, 2, 2, 0, 1);
516 QToolButton* aBackBtn = new QToolButton(myPlayFrame);
517 aBackBtn->setIconSet(QPixmap(leftIco));
518 connect( aBackBtn, SIGNAL( clicked() ),
519 this, SLOT( onBackPressed() ) );
520 TopLayout->addWidget(aBackBtn, 3, 0);
522 QToolButton* aForvardBtn = new QToolButton(myPlayFrame);
523 aForvardBtn->setIconSet(QPixmap(rightIco));
524 connect( aForvardBtn, SIGNAL( clicked() ),
525 this, SLOT( onForvardPressed() ) );
526 TopLayout->addWidget(aForvardBtn, 3, 1);
528 QToolButton* aFirstBtn = new QToolButton(myPlayFrame);
529 aFirstBtn->setIconSet(QPixmap(firstIco));
530 connect( aFirstBtn, SIGNAL( clicked() ),
531 this, SLOT( onFirstPressed() ) );
532 TopLayout->addWidget(aFirstBtn, 4, 0);
534 QToolButton* aLastBtn = new QToolButton(myPlayFrame);
535 aLastBtn->setIconSet(QPixmap(lastIco));
536 connect( aLastBtn, SIGNAL( clicked() ),
537 this, SLOT( onLastPressed() ) );
538 TopLayout->addWidget(aLastBtn, 4, 1);
540 QLabel* aSpeedLbl = new QLabel("Speed", myPlayFrame);
541 TopLayout->addWidget(aSpeedLbl, 4, 2, Qt::AlignRight);
543 QLCDNumber* aSpeedNum = new QLCDNumber( 2, myPlayFrame );
544 aSpeedNum->setSegmentStyle(QLCDNumber::Flat);
545 aSpeedNum->display(1);
546 TopLayout->addWidget(aSpeedNum, 4, 3);
548 QwtWheel* aWheel = new QwtWheel(myPlayFrame);
549 aWheel->setOrientation(Qt::Vertical);
550 aWheel->setRange(1, 99, 1);
551 connect( aWheel, SIGNAL(valueChanged(double)),
552 aSpeedNum, SLOT(display(double)) );
553 connect( aWheel, SIGNAL(valueChanged(double)),
554 this, SLOT(onSpeedChange(double)) );
555 TopLayout->addMultiCellWidget(aWheel, 1, 3, 3, 3, Qt::AlignRight);
557 QCheckBox* aCycleCheck = new QCheckBox("Cycled animation",myPlayFrame);
558 aCycleCheck->setChecked(myAnimator->isCycling());
559 connect(aCycleCheck, SIGNAL(toggled(bool)), myAnimator, SLOT(setCyclingSlot(bool)));
560 TopLayout->addMultiCellWidget(aCycleCheck, 5, 5, 0, 3);
562 QCheckBox* aPropCheck = new QCheckBox("Use proportional timing",myPlayFrame);
563 aPropCheck->setChecked(myAnimator->isProportional());
564 connect(aPropCheck, SIGNAL(toggled(bool)), myAnimator, SLOT(setProportionalSlot(bool)));
565 TopLayout->addMultiCellWidget(aPropCheck, 6, 6, 0, 3);
567 QGroupBox* aSaveBox = new QGroupBox( "Saving", myPlayFrame );
568 aSaveBox->setColumnLayout(0, Qt::Horizontal );
569 QGridLayout* aSaveLay = new QGridLayout(aSaveBox->layout());
570 aSaveLay->setSpacing( 5 );
571 aSaveLay->setMargin( 5 );
573 mySaveCheck = new QCheckBox("Save pictures to directory", aSaveBox);
574 aSaveLay->addMultiCellWidget(mySaveCheck, 0, 0, 0, 2);
575 connect(mySaveCheck, SIGNAL( toggled(bool)),
576 aWheel, SLOT( setDisabled(bool) ));
578 QLabel* aPathLbl = new QLabel("Path:", aSaveBox);
579 aPathLbl->setEnabled(false);
580 connect(mySaveCheck, SIGNAL( toggled(bool)),
581 aPathLbl, SLOT( setEnabled(bool) ));
582 aSaveLay->addWidget(aPathLbl, 1, 0);
584 myPathEdit = new QLineEdit(aSaveBox);
585 myPathEdit->setEnabled(false);
586 connect(mySaveCheck, SIGNAL( toggled(bool)),
587 myPathEdit, SLOT( setEnabled(bool) ));
588 aSaveLay->addWidget(myPathEdit, 1, 1);
590 QPushButton* aBrowseBtn = new QPushButton("Browse...", aSaveBox);
591 aBrowseBtn->setEnabled(false);
592 connect(mySaveCheck, SIGNAL( toggled(bool)),
593 aBrowseBtn, SLOT( setEnabled(bool) ));
594 connect(aBrowseBtn, SIGNAL( clicked()),
595 this, SLOT( onBrowse() ));
596 mySaveCheck->setChecked(false);
597 aSaveLay->addWidget(aBrowseBtn, 1, 2);
599 TopLayout->addMultiCellWidget(aSaveBox, 7, 7, 0, 3);
601 aMainLayout->addWidget(myPlayFrame);
603 QHBox* aBtnBox = new QHBox(this);
604 QHBoxLayout* aBtnLayout = new QHBoxLayout(aBtnBox->layout());
605 aBtnLayout->addStretch();
607 QPushButton* aCloseBtn = new QPushButton(tr("BUT_CLOSE"), aBtnBox);
608 connect(aCloseBtn, SIGNAL(clicked()), this, SLOT(close()));
610 aMainLayout->addWidget(aBtnBox);
612 myPlayFrame->setEnabled(false);
615 //************************************************************************
616 VisuGUI_TimeAnimationDlg::~VisuGUI_TimeAnimationDlg()
621 //************************************************************************
622 void VisuGUI_TimeAnimationDlg::onTypeChange (int index)
625 myPropBtn->setEnabled(index != 0);
628 myPlayFrame->setEnabled(false);
631 //************************************************************************
632 void VisuGUI_TimeAnimationDlg::addField (_PTR(SObject) theSObject)
634 myPlayFrame->setEnabled(false);
635 myAnimator->addField(VISU::GetSObject(theSObject));
638 //************************************************************************
639 void VisuGUI_TimeAnimationDlg::createFrames()
642 SUIT_OverrideCursor c;
644 for (int i = 0; i < myAnimator->getNbFields(); i++) {
645 if (myAnimator->getFieldData(i).myPrs.empty())
646 myAnimator->generatePresentations(i);
648 if (myAnimator->getNbFrames() == 0) {
649 myPlayFrame->setEnabled(false);
651 SUIT_MessageBox::warn1(this,
653 tr("MSG_NO_ANIMATIONDATA"),
657 mySlider->setMaxValue(myAnimator->getNbFrames()-1);
658 myPlayFrame->setEnabled(true);
659 if (!myAnimator->generateFrames()) {
661 //myPlayFrame->setEnabled(false);
662 SUIT_MessageBox::warn1(this,
664 myAnimator->getLastErrorMsg(),
668 //myPlayFrame->setEnabled(true);
671 //************************************************************************
672 void VisuGUI_TimeAnimationDlg::onPlayPressed()
674 if (myPlayBtn->isOn() && (!myAnimator->running())) {
675 myPlayBtn->setIconSet(MYpausePixmap);
676 if (mySaveCheck->isChecked())
677 myAnimator->dumpTo(myPathEdit->text());
679 myAnimator->dumpTo("");
680 mySetupBtn->setEnabled(false);
681 myGenBtn->setEnabled(false);
682 myAnimator->startAnimation();
684 myPlayBtn->setIconSet(MYplayPixmap);
685 myAnimator->stopAnimation();
686 mySetupBtn->setEnabled(true);
687 myGenBtn->setEnabled(true);
691 //************************************************************************
692 void VisuGUI_TimeAnimationDlg::onBackPressed()
695 myAnimator->prevFrame();
698 //************************************************************************
699 void VisuGUI_TimeAnimationDlg::onForvardPressed()
701 myAnimator->nextFrame();
704 //************************************************************************
705 void VisuGUI_TimeAnimationDlg::onLastPressed()
707 myAnimator->lastFrame();
710 //************************************************************************
711 void VisuGUI_TimeAnimationDlg::onFirstPressed()
713 myAnimator->firstFrame();
716 //************************************************************************
717 void VisuGUI_TimeAnimationDlg::clearView()
719 myAnimator->clearView();
722 //************************************************************************
723 void VisuGUI_TimeAnimationDlg::closeEvent (QCloseEvent* theEvent)
725 myAnimator->stopAnimation();
726 if (myAnimator->running() && (! myAnimator->finished())) {
730 QDialog::closeEvent(theEvent);
734 //************************************************************************
735 void VisuGUI_TimeAnimationDlg::onWindowChanged (int index)
737 if (myAnimator->isRunning()) return;
738 myAnimator->gotoFrame(index);
741 //************************************************************************
742 void VisuGUI_TimeAnimationDlg::onSpeedChange (double theSpeed)
744 myAnimator->setSpeed((int)theSpeed);
747 //************************************************************************
748 void VisuGUI_TimeAnimationDlg::stopAnimation()
750 myAnimator->stopAnimation();
751 myPlayBtn->setOn(false);
752 myPlayBtn->setIconSet(MYplayPixmap);
753 mySetupBtn->setEnabled(true);
754 myGenBtn->setEnabled(true);
757 //************************************************************************
758 void VisuGUI_TimeAnimationDlg::onExecution (long theNewFrame, double theTime)
760 myTimeLbl->setText(QString("%1").arg(theTime));
761 mySlider->setValue(theNewFrame);
764 //************************************************************************
765 void VisuGUI_TimeAnimationDlg::onSetupDlg()
767 if (myAnimator->getNbFrames() > 0) myAnimator->firstFrame();
768 SetupDlg* aDlg = new SetupDlg(this, myAnimator);
770 myPlayFrame->setEnabled(false);
774 //************************************************************************
775 void VisuGUI_TimeAnimationDlg::onBrowse()
777 QString aPath = SUIT_FileDlg::getExistingDirectory(this, "/","Select path");
778 if (!aPath.isEmpty())
779 myPathEdit->setText(aPath);
782 //************************************************************************
783 void VisuGUI_TimeAnimationDlg::onStop()
786 QDialog::closeEvent(myEvent);
788 myPlayBtn->setOn(false);
789 myPlayBtn->setIconSet(MYplayPixmap);
790 mySetupBtn->setEnabled(true);
791 myGenBtn->setEnabled(true);