Fixed BOARD_COMMIT::Revert()

Revert() method was still not aware of CHT_DONE flag, therefore
the switch statement was always invalid. To fix it, the commit
type is split to type and flags as is done in Push() method.
This commit is contained in:
Maciej Suminski 2017-12-14 17:07:44 +01:00
parent d599a83c4b
commit 9c2d1cf890
1 changed files with 10 additions and 2 deletions

View File

@ -317,16 +317,24 @@ void BOARD_COMMIT::Revert()
COMMIT_LINE& ent = *it;
BOARD_ITEM* item = static_cast<BOARD_ITEM*>( ent.m_item );
BOARD_ITEM* copy = static_cast<BOARD_ITEM*>( ent.m_copy );
int changeType = ent.m_type & CHT_TYPE;
int changeFlags = ent.m_type & CHT_FLAGS;
switch( ent.m_type )
switch( changeType )
{
case CHT_ADD:
if( !( changeFlags & CHT_DONE ) )
break;
view->Remove( item );
connectivity->Remove( item );
board->Remove( item );
break;
case CHT_REMOVE:
if( !( changeFlags & CHT_DONE ) )
break;
if( item->Type() == PCB_MODULE_T )
{
MODULE* newModule = static_cast<MODULE*>( item );
@ -335,6 +343,7 @@ void BOARD_COMMIT::Revert()
view->Add( item );
connectivity->Add( item );
board->Add( item );
break;
case CHT_MODIFY:
@ -343,7 +352,6 @@ void BOARD_COMMIT::Revert()
connectivity->Remove( item );
item->SwapData( copy );
item->ClearFlags( SELECTED );
// Update all pads/drawings/texts, as they become invalid