mirror of
https://github.com/LMMS/lmms.git
synced 2026-03-19 06:28:24 -04:00
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:
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user