pcbnew: Don't stage undo commits on new items

New items just being placed on the board are still temporary.  Although
we can modify their orientations/positions, we can't stage these changes
for undo/redo without corrupting the undo stack.

Fixes: lp:1776312
* https://bugs.launchpad.net/kicad/+bug/1776312
This commit is contained in:
Seth Hillbrand 2018-06-11 16:41:24 -07:00
parent 896ad3774d
commit 61c3bc4af4
1 changed files with 13 additions and 4 deletions

View File

@ -693,7 +693,9 @@ int EDIT_TOOL::Rotate( const TOOL_EVENT& aEvent )
for( auto item : selection ) for( auto item : selection )
{ {
if( !item->IsNew() )
m_commit->Modify( item ); m_commit->Modify( item );
static_cast<BOARD_ITEM*>( item )->Rotate( selection.GetReferencePoint(), rotateAngle ); static_cast<BOARD_ITEM*>( item )->Rotate( selection.GetReferencePoint(), rotateAngle );
} }
@ -769,7 +771,10 @@ int EDIT_TOOL::Mirror( const TOOL_EVENT& aEvent )
case PCB_MODULE_EDGE_T: case PCB_MODULE_EDGE_T:
case PCB_MODULE_TEXT_T: case PCB_MODULE_TEXT_T:
case PCB_PAD_T: case PCB_PAD_T:
// Only create undo entry for items on the board
if( !item->IsNew() )
m_commit->Modify( item ); m_commit->Modify( item );
break; break;
default: default:
continue; continue;
@ -833,7 +838,9 @@ int EDIT_TOOL::Flip( const TOOL_EVENT& aEvent )
for( auto item : selection ) for( auto item : selection )
{ {
if( !item->IsNew() )
m_commit->Modify( item ); m_commit->Modify( item );
static_cast<BOARD_ITEM*>( item )->Flip( modPoint ); static_cast<BOARD_ITEM*>( item )->Flip( modPoint );
} }
@ -923,7 +930,9 @@ int EDIT_TOOL::MoveExact( const TOOL_EVENT& aEvent )
for( auto item : selection ) for( auto item : selection )
{ {
if( !item->IsNew() )
m_commit->Modify( item ); m_commit->Modify( item );
static_cast<BOARD_ITEM*>( item )->Move( finalMoveVector ); static_cast<BOARD_ITEM*>( item )->Move( finalMoveVector );
static_cast<BOARD_ITEM*>( item )->Rotate( rotPoint, params.rotation ); static_cast<BOARD_ITEM*>( item )->Rotate( rotPoint, params.rotation );