50 #include "GroupData.hh" 52 #include "GroupBackup.hh" 77 if ( undoStates_.empty() )
85 IdList ids = current->objectIDs();
87 for (
unsigned int i=0; i < ids.size(); i++ ){
100 backupData =
dynamic_cast< BackupData*
>(
object->objectData(OBJECT_BACKUPS));
110 undoStates_.pop_back();
111 redoStates_.push_back( currentState_ );
112 currentState_ = backup;
126 if ( redoStates_.empty() )
131 if ( redoState == 0 )
134 IdList ids = redoState->objectIDs();
136 for (
unsigned int i=0; i < ids.size(); i++ ){
149 backupData =
dynamic_cast< BackupData*
>(
object->objectData(OBJECT_BACKUPS));
159 redoStates_.pop_back();
160 undoStates_.push_back( currentState_ );
161 currentState_ = backup;
184 if ( current->contains(_objectid) ){
189 undoStates_.pop_back();
190 redoStates_.push_back( currentState_ );
191 currentState_ = backup;
197 int backupIndex = -1;
199 for(
int i=undoStates_.size()-1; i >= 0; --i){
201 if ( back->contains(_objectid) ){
212 undoStates_.erase( undoStates_.begin() + backupIndex );
213 redoStates_.push_back( backup );
215 std::cerr <<
"Error: Cannot updateBackupData. Backup is blocked!" << std::endl;
222 int backupIndex = -1;
224 for(
int i=redoStates_.size()-1; i >= 0; --i){
226 if ( back->contains(_objectid) ){
237 redoStates_.erase( redoStates_.begin() + backupIndex );
238 undoStates_.push_back( currentState_ );
239 currentState_ = backup;
241 std::cerr <<
"Error: Cannot updateBackupData. Backup is blocked!" << std::endl;
265 std::cerr <<
"Cannot undo operation. This backup involves multiple objects!" << std::endl;
291 std::cerr <<
"Cannot redo operation. This backup involves multiple objects!" << std::endl;
304 if (dynamic_cast<const GroupBackup* >(_b) && dynamic_cast<const GroupBackup* >(_b)->contains(id_))
318 undoStates_.erase(std::remove_if(undoStates_.begin(),undoStates_.end(),
ContainsId_deleter(_objectid)), undoStates_.end());
319 redoStates_.erase(std::remove_if(redoStates_.begin(),redoStates_.end(),
ContainsId_deleter(_objectid)), redoStates_.end());
325 if (!undoStates_.empty())
327 currentState_ = undoStates_.back();
328 undoStates_.pop_back();
329 }
else if (!redoStates_.empty())
331 currentState_ = redoStates_.back();
332 redoStates_.pop_back();
void updateBackupData(int _objectid, bool _isUndo)
remove object from data
bool redoBlocked()
return if a redo backup is blocked
void redo()
perform an redo if possible
bool getObject(int _identifier, BSplineCurveObject *&_object)
bool blocked()
Returns if this backup is blocked.
void undo()
perform an undo if possible
Abstract class that is used to store backups.
Class that encapsulates a backup.
bool undoBlocked()
return if an undo backup is blocked
void eraseBackups(int _objectid)
erase all backups containing given id
bool hasObjectData(QString _dataName)
Checks if object data with given name is available.
std::vector< int > IdList
Standard Type for id Lists used for scripting.
void redo()
perform a redo if possible
Class that encapsulates simultaneous backups on multiple objects.
void undo()
perform an undo if possible