allow redo

allow undo through revert
This commit is contained in:
Glenn Maynard
2005-07-20 06:47:30 +00:00
parent 9cf604c036
commit b81fdd8e4e
+6 -6
View File
@@ -1987,20 +1987,18 @@ void ScreenEdit::HandleScreenMessage( const ScreenMessage SM )
{ {
if( ScreenPrompt::s_LastAnswer == ANSWER_YES ) if( ScreenPrompt::s_LastAnswer == ANSWER_YES )
{ {
SaveUndo();
CopyFromLastSave(); CopyFromLastSave();
m_pSteps->GetNoteData( m_NoteDataEdit ); m_pSteps->GetNoteData( m_NoteDataEdit );
m_bHasUndo = false;
m_Undo.ClearAll();
} }
} }
else if( SM == SM_DoRevertFromDisk ) else if( SM == SM_DoRevertFromDisk )
{ {
if( ScreenPrompt::s_LastAnswer == ANSWER_YES ) if( ScreenPrompt::s_LastAnswer == ANSWER_YES )
{ {
SaveUndo();
RevertFromDisk(); RevertFromDisk();
m_pSteps->GetNoteData( m_NoteDataEdit ); m_pSteps->GetNoteData( m_NoteDataEdit );
m_bHasUndo = false;
m_Undo.ClearAll();
} }
} }
else if( SM == SM_DoSaveAndExit ) // just asked "save before exiting? yes, no, cancel" else if( SM == SM_DoSaveAndExit ) // just asked "save before exiting? yes, no, cancel"
@@ -2886,9 +2884,9 @@ void ScreenEdit::Undo()
{ {
if( m_bHasUndo ) if( m_bHasUndo )
{ {
NoteData temp( m_NoteDataEdit );
m_NoteDataEdit.CopyAll( m_Undo ); m_NoteDataEdit.CopyAll( m_Undo );
m_bHasUndo = false; m_Undo.CopyAll( temp );
m_Undo.ClearAll();
SCREENMAN->SystemMessage( "Undo" ); SCREENMAN->SystemMessage( "Undo" );
} }
else else
@@ -2908,6 +2906,7 @@ void ScreenEdit::CheckNumberOfNotesAndUndo()
if( iNumNotesThisMeasure > MAX_NOTES_PER_MEASURE ) if( iNumNotesThisMeasure > MAX_NOTES_PER_MEASURE )
{ {
Undo(); Undo();
m_bHasUndo = false;
CString sError = ssprintf( CString sError = ssprintf(
"This change creates more than %d notes in a measure.\n\nMore than %d notes per measure is not allowed. This change has been reverted.", "This change creates more than %d notes in a measure.\n\nMore than %d notes per measure is not allowed. This change has been reverted.",
MAX_NOTES_PER_MEASURE, MAX_NOTES_PER_MEASURE ); MAX_NOTES_PER_MEASURE, MAX_NOTES_PER_MEASURE );
@@ -2927,6 +2926,7 @@ void ScreenEdit::CheckNumberOfNotesAndUndo()
if( bLastBeatIncreased && bPassedTheEnd ) if( bLastBeatIncreased && bPassedTheEnd )
{ {
Undo(); Undo();
m_bHasUndo = false;
CString sError = ssprintf( CString sError = ssprintf(
"This change creates notes past the end of the music and is not allowed.\n\nThe change has been reverted." ); "This change creates notes past the end of the music and is not allowed.\n\nThe change has been reverted." );
ScreenPrompt::Prompt( SM_None, sError ); ScreenPrompt::Prompt( SM_None, sError );