Undo manager - Fixed some bugs
This commit is contained in:
parent
d9b82db5d4
commit
5445021664
3 changed files with 10 additions and 3 deletions
2
Makefile
2
Makefile
|
@ -29,6 +29,7 @@ COMMON = \
|
||||||
profiling.cc \
|
profiling.cc \
|
||||||
shaders.cc \
|
shaders.cc \
|
||||||
odbg.cc \
|
odbg.cc \
|
||||||
|
undo.cc \
|
||||||
\
|
\
|
||||||
sync.cc \
|
sync.cc \
|
||||||
syncoverrides.cc \
|
syncoverrides.cc \
|
||||||
|
@ -45,7 +46,6 @@ DEMO = \
|
||||||
main.cc \
|
main.cc \
|
||||||
syncedit.cc \
|
syncedit.cc \
|
||||||
syncview.cc \
|
syncview.cc \
|
||||||
undo.cc \
|
|
||||||
# END DEMO
|
# END DEMO
|
||||||
|
|
||||||
PARSERCHECK = \
|
PARSERCHECK = \
|
||||||
|
|
9
undo.cc
9
undo.cc
|
@ -10,6 +10,13 @@ A_UndoAction::~A_UndoAction( )
|
||||||
|
|
||||||
/*= T_UndoManager ==============================================================*/
|
/*= T_UndoManager ==============================================================*/
|
||||||
|
|
||||||
|
T_UndoManager::T_UndoManager( ) noexcept
|
||||||
|
{
|
||||||
|
while ( actions_.size( ) < MaxUndo ) {
|
||||||
|
actions_.addNew( );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void T_UndoManager::undo( ) noexcept
|
void T_UndoManager::undo( ) noexcept
|
||||||
{
|
{
|
||||||
if ( pos_ > 0 ) {
|
if ( pos_ > 0 ) {
|
||||||
|
@ -21,8 +28,8 @@ void T_UndoManager::undo( ) noexcept
|
||||||
void T_UndoManager::redo( ) noexcept
|
void T_UndoManager::redo( ) noexcept
|
||||||
{
|
{
|
||||||
if ( pos_ < count_ ) {
|
if ( pos_ < count_ ) {
|
||||||
pos_ ++;
|
|
||||||
actions_[ ( start_ + pos_ ) % MaxUndo ]->redo( );
|
actions_[ ( start_ + pos_ ) % MaxUndo ]->redo( );
|
||||||
|
pos_ ++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
2
undo.hh
2
undo.hh
|
@ -27,7 +27,7 @@ class T_UndoManager
|
||||||
uint32_t pos_{ 0 };
|
uint32_t pos_{ 0 };
|
||||||
|
|
||||||
public:
|
public:
|
||||||
T_UndoManager( ) noexcept = default;
|
T_UndoManager( ) noexcept;
|
||||||
DEF_MOVE( T_UndoManager );
|
DEF_MOVE( T_UndoManager );
|
||||||
NO_COPY( T_UndoManager );
|
NO_COPY( T_UndoManager );
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue