m_MeshWriterClass( "" ),
m_MeshCutterClass( "" ),
m_Image( NULL ),
- m_state(1)
+ m_state(0),
+ m_max_state(0)
{
this->m_UI->setupUi( this );
this->m_MPRObjects->ResetCameras( );
this->m_MPRObjects->RenderAll( );
- MementoState(m_state, this->m_Image);
+ MementoState(m_state, this->m_Image);
+ this->m_state++;
}
else
QMessageBox::critical(
this->m_Image->GetVTK< vtkImageData >( )
);
- m_state++;
- MementoState(m_state, this->m_Image);
+
+
+ MementoState(this->m_state, this->m_Image);
+ this->m_state++;
+ if (this->m_state > this->m_max_state)
+ {
+ this->m_max_state = this->m_state;
+ }
}
else
QMessageBox::critical(
);
} else
{
- QMessageBox::critical(
+ QMessageBox::warning(
this,
- tr("Error message"),
+ tr("message"),
tr("No history to undo")
);
}
_triggered_actionRedo()
{
MementoState memento = MementoState();
- try
- {
- this->m_state++;
- this->m_MPRObjects->SetImage(
- memento.getMemento(this->m_state)->GetOutput()
- );
- }
- catch (int err)
- {
- QMessageBox::critical(
- this,
- tr("Error message"),
- tr("No history to redo")
- );
- }
+ if (this->m_state + 1 <= m_max_state)
+ {
+ this->m_state++;
+ this->m_MPRObjects->SetImage(
+ memento.getMemento(this->m_state)->GetOutput()
+ );
+ } else
+ {
+ QMessageBox::warning(
+ this,
+ tr("message"),
+ tr("No history to redo")
+ );
+ }
+
}