Undo manager - Fixed some bugs

This commit is contained in:
Emmanuel BENOîT 2017-11-22 14:13:43 +01:00
parent d9b82db5d4
commit 5445021664
3 changed files with 10 additions and 3 deletions

View file

@ -29,6 +29,7 @@ COMMON = \
profiling.cc \
shaders.cc \
odbg.cc \
undo.cc \
\
sync.cc \
syncoverrides.cc \
@ -45,7 +46,6 @@ DEMO = \
main.cc \
syncedit.cc \
syncview.cc \
undo.cc \
# END DEMO
PARSERCHECK = \

View file

@ -10,6 +10,13 @@ A_UndoAction::~A_UndoAction( )
/*= T_UndoManager ==============================================================*/
T_UndoManager::T_UndoManager( ) noexcept
{
while ( actions_.size( ) < MaxUndo ) {
actions_.addNew( );
}
}
void T_UndoManager::undo( ) noexcept
{
if ( pos_ > 0 ) {
@ -21,8 +28,8 @@ void T_UndoManager::undo( ) noexcept
void T_UndoManager::redo( ) noexcept
{
if ( pos_ < count_ ) {
pos_ ++;
actions_[ ( start_ + pos_ ) % MaxUndo ]->redo( );
pos_ ++;
}
}

View file

@ -27,7 +27,7 @@ class T_UndoManager
uint32_t pos_{ 0 };
public:
T_UndoManager( ) noexcept = default;
T_UndoManager( ) noexcept;
DEF_MOVE( T_UndoManager );
NO_COPY( T_UndoManager );