Revised journalling (undo/redo) to record full states instead of changes

Recording single changes of objects or their specific properties is
completely superfluous as we have full implemented state tracking in all
objects already. Therefore use SerializingObject::saveState() and
SerializingObject::restoreState() in order to implement the undo/redo
functionality.

This is just an initial commit and needs some further work (especially
regarding stability). However even things like undo/redo of
addition/removal of Tracks and TrackContentObjects do work already.
This commit is contained in:
Tobias Doerffel
2014-01-07 23:42:17 +01:00
parent ddad2da162
commit a5c3cf6a99
15 changed files with 134 additions and 488 deletions

View File

@@ -1,7 +1,7 @@
/*
* ProjectJournal.cpp - implementation of ProjectJournal
*
* Copyright (c) 2006-2009 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2006-2014 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
@@ -60,7 +60,10 @@ void ProjectJournal::undo()
if( m_currentJournalEntry - 1 >= m_journalEntries.begin() &&
( jo = m_joIDs[*--m_currentJournalEntry] ) != NULL )
{
bool prev = isJournalling();
setJournalling( false );
jo->undo();
setJournalling( prev );
engine::getSong()->setModified();
}
}
@@ -81,7 +84,10 @@ void ProjectJournal::redo()
if( m_currentJournalEntry < m_journalEntries.end() &&
( jo = m_joIDs[*m_currentJournalEntry++] ) != NULL )
{
bool prev = isJournalling();
setJournalling( false );
jo->redo();
setJournalling( prev );
engine::getSong()->setModified();
}
}