diff options
author | Mahmoud Badri <mahmoud.badri@qt.io> | 2018-12-07 16:19:13 +0200 |
---|---|---|
committer | Miikka Heikkinen <miikka.heikkinen@qt.io> | 2018-12-10 08:32:45 +0000 |
commit | cf54ebd6f3591c09a7d3c1e5fdde9d8be163f02d (patch) | |
tree | ffc532db256018f7f09b141c330e15dca30b685b /src/Authoring/Client/Code/Core/Commands/CmdStack.cpp | |
parent | 69c3a54687eed3bca968aaba4efd87334df7304f (diff) |
Also removed a previous hot fix (QT3DS-2768) and some cleanups in the
undo/redo system.
Task-number: QT3DS-2827
Change-Id: Id1bb8e89c4121dd3cf447bf29c1a0d02d034e247
Reviewed-by: Tomi Korpipää <tomi.korpipaa@qt.io>
Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
Diffstat (limited to 'src/Authoring/Client/Code/Core/Commands/CmdStack.cpp')
-rw-r--r-- | src/Authoring/Client/Code/Core/Commands/CmdStack.cpp | 27 |
1 files changed, 10 insertions, 17 deletions
diff --git a/src/Authoring/Client/Code/Core/Commands/CmdStack.cpp b/src/Authoring/Client/Code/Core/Commands/CmdStack.cpp index 3530822f..76f51126 100644 --- a/src/Authoring/Client/Code/Core/Commands/CmdStack.cpp +++ b/src/Authoring/Client/Code/Core/Commands/CmdStack.cpp @@ -27,16 +27,13 @@ ** ****************************************************************************/ -#include "Qt3DSCommonPrecompile.h" #include "CmdStack.h" #include "Cmd.h" #include "CmdStackModifier.h" CCmdStack::CCmdStack() { - m_Listener = NULL; - m_MaxUndoStackSize = 100; - m_CommandStackModifier = NULL; + } CCmdStack::~CCmdStack() @@ -66,14 +63,13 @@ bool CCmdStack::ExecuteCommand(CCmd *inCommand) // Execute the command. unsigned long theUpdateMask = inCommand->Do(); - // If the listener is not null then do the notifications. - if (m_Listener != NULL) { + if (m_Listener) { m_Listener->CommandUpdate(theUpdateMask); // Set the modified flag if it needs to be set. if (inCommand->ShouldSetModifiedFlag()) { - m_Listener->SetCommandModifiedFlag(TRUE); + m_Listener->SetCommandModifiedFlag(true); } } @@ -135,11 +131,11 @@ bool CCmdStack::ExecuteCommand(CCmd *inCommand) //============================================================================= void CCmdStack::Undo() { - if (m_CommandStackModifier) { if (m_CommandStackModifier->PreUndo() == false) return; } + if (m_UndoList.size() > 0) { m_undoingOrRedoing = true; CCmd *theLastCommand = m_UndoList.back(); @@ -147,7 +143,6 @@ void CCmdStack::Undo() unsigned long theUpdateMask = theLastCommand->Undo(); - // Once a command is undone then it is considered committed. Prevents merging after this has // been redone. theLastCommand->SetCommitted(true); @@ -155,13 +150,12 @@ void CCmdStack::Undo() m_RedoList.push_back(theLastCommand); // If the listener is not null then do the notifications. - if (m_Listener != NULL) { + if (m_Listener) { m_Listener->CommandUpdate(theUpdateMask); // Set the modified flag if it needs to be set. - if (theLastCommand->ShouldSetModifiedFlag()) { - m_Listener->SetCommandModifiedFlag(TRUE); - } + if (theLastCommand->ShouldSetModifiedFlag()) + m_Listener->SetCommandModifiedFlag(true); } m_undoingOrRedoing = false; } @@ -186,13 +180,12 @@ void CCmdStack::Redo() m_UndoList.push_back(theLastCommand); // If the listener is not null then do the notifications. - if (m_Listener != NULL) { + if (m_Listener) { m_Listener->CommandUpdate(theUpdateMask); // Set the modified flag if it needs to be set. - if (theLastCommand->ShouldSetModifiedFlag()) { - m_Listener->SetCommandModifiedFlag(TRUE); - } + if (theLastCommand->ShouldSetModifiedFlag()) + m_Listener->SetCommandModifiedFlag(true); } m_undoingOrRedoing = false; } |