setCaption(tr("SUCCESSIVE_ANIMATION"));
setSizeGripEnabled( TRUE );
isClosing = false;
+ myCloseBtnClicked = false;
myAnimator = new VISU_TimeAnimation (theStudy);
myAnimator->setViewer(VISU::GetActiveViewWindow<SVTK_ViewWindow>(theModule));
aBtnLayout->addStretch();
QPushButton* aCloseBtn = new QPushButton(tr("BUT_CLOSE"), aBtnBox);
- connect(aCloseBtn, SIGNAL(clicked()), this, SLOT(close()));
+ connect(aCloseBtn, SIGNAL(clicked()), this, SLOT(onClose()));
QPushButton* aHelpBtn = new QPushButton(tr("BUT_HELP"), aBtnBox);
connect(aHelpBtn, SIGNAL(clicked()), this, SLOT(onHelp()));
if(myAnimator != NULL){
delete myAnimator;
myAnimator = NULL;
- VISU::GetActiveViewWindow<SVTK_ViewWindow>(myModule)->Repaint();
+ if ( VISU::GetActiveViewWindow<SVTK_ViewWindow>(myModule) )
+ VISU::GetActiveViewWindow<SVTK_ViewWindow>(myModule)->Repaint();
}
}
QDialog::reject();
}
+void VisuGUI_TimeAnimationDlg::onClose()
+{
+ myCloseBtnClicked = true;
+ close();
+}
+
//------------------------------------------------------------------------
void VisuGUI_TimeAnimationDlg::closeEvent (QCloseEvent* theEvent)
{
// * Destroing data in myAnimator before study closed.
// * It needed for correcting destroing of myAnimator, which
// * depend from SVTK_RenderWindowInteractor() e.t.c.
- if(theEvent->type() == QEvent::Close){
- for (int i = 0; i < myAnimator->getNbFields(); i++)
+ if(theEvent->type() == QEvent::Close && !myCloseBtnClicked){
+ for (int i = 0; (myAnimator != NULL) && (i < myAnimator->getNbFields()); i++)
myAnimator->clearData(myAnimator->getFieldData(i));
myAnimator->clearFieldData();
}
virtual void keyPressEvent(QKeyEvent* theEvent);
virtual void reject();
void stopAnimation();
-
+
private slots:
void onTypeChange(int index);
void onPlayPressed();
void onPicsFormatChanged();
/*!Sets path for myAnimator (dumpTo(...)), from myPathEdit.*/
void onPathChanged();
+ void onClose();
private:
QSlider* mySlider;
QComboBox* myPicsFormat;
QLineEdit* myPathEdit;
bool isClosing;
+ bool myCloseBtnClicked;
QCloseEvent* myEvent;
QCheckBox* mySaveAVICheck;
for (int i = 0; i < getNbFields(); i++) {
clearData(myFieldsLst[i]);
}
-
+ clearFieldData();
/* Terminates the execution of the thread.
* The thread may or may not be terminated immediately,
* depending on the operating system's scheduling policies.
void VISU_TimeAnimation::_visibilityOff(int num_field, int num_frame) {
if ( num_field < 0 || num_frame < 0 ) return;
FieldData& aData = myFieldsLst[num_field];
+ if ( aData.myActors.empty() ) return;
VISU_Actor* aActor = aData.myActors[num_frame];
if (! myCleaningMemoryAtEachFrame) {
//
while (myIsActive) {
ProcessVoidEvent(new TVoidMemFun2ArgEvent<VISU_TimeAnimation,long,double>(this, &VISU_TimeAnimation::_emitFrameChanged,
myFrame, myFieldsLst[0].myTiming[myFrame]));
+ if (myIsActive) {
if(!(myFieldsLst[0].myField))
break;
for (int i = 0; i < getNbFields(); i++) {
ProcessVoidEvent(new TVoidMemFun1ArgEvent<SVTK_ViewWindow,bool>(myView,
&SVTK_ViewWindow::Repaint,
repainArg));
+ }
k = 1;
if (myProportional) {
ProcessVoidEvent(new TVoidMemFun2ArgEvent<VISU_TimeAnimation,long,double>(this, &VISU_TimeAnimation::_emitFrameChanged,
myFrame, myFieldsLst[aFieldId].myTiming[aFrame]));
+ if (myIsActive) {
if (aFrame > 0) {
if (aData.myActors[aFrame-1] != 0)
visibilityOff(aFieldId, aFrame-1);
ProcessVoidEvent(new TVoidMemFun1ArgEvent<SVTK_ViewWindow,bool>(myView,
&SVTK_ViewWindow::Repaint,
repainArg));
+ }
k = 1;
if (myProportional) {