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:
parent
896ad3774d
commit
61c3bc4af4
|
@ -693,7 +693,9 @@ int EDIT_TOOL::Rotate( const TOOL_EVENT& aEvent )
|
|||
|
||||
for( auto item : selection )
|
||||
{
|
||||
m_commit->Modify( item );
|
||||
if( !item->IsNew() )
|
||||
m_commit->Modify( item );
|
||||
|
||||
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_TEXT_T:
|
||||
case PCB_PAD_T:
|
||||
m_commit->Modify( item );
|
||||
// Only create undo entry for items on the board
|
||||
if( !item->IsNew() )
|
||||
m_commit->Modify( item );
|
||||
|
||||
break;
|
||||
default:
|
||||
continue;
|
||||
|
@ -833,7 +838,9 @@ int EDIT_TOOL::Flip( const TOOL_EVENT& aEvent )
|
|||
|
||||
for( auto item : selection )
|
||||
{
|
||||
m_commit->Modify( item );
|
||||
if( !item->IsNew() )
|
||||
m_commit->Modify( item );
|
||||
|
||||
static_cast<BOARD_ITEM*>( item )->Flip( modPoint );
|
||||
}
|
||||
|
||||
|
@ -923,7 +930,9 @@ int EDIT_TOOL::MoveExact( const TOOL_EVENT& aEvent )
|
|||
|
||||
for( auto item : selection )
|
||||
{
|
||||
m_commit->Modify( item );
|
||||
if( !item->IsNew() )
|
||||
m_commit->Modify( item );
|
||||
|
||||
static_cast<BOARD_ITEM*>( item )->Move( finalMoveVector );
|
||||
static_cast<BOARD_ITEM*>( item )->Rotate( rotPoint, params.rotation );
|
||||
|
||||
|
|
Loading…
Reference in New Issue