Commit c89d52ee authored by Wayne Stambaugh's avatar Wayne Stambaugh

Pcbnew: make block rotate honor the rotation angle setting. (fixes lp:1281605)

* Make block rotate command honor the rotation angle setting.  Thank you
  Umesh Mohan <mohan.umesh@gmail.com> for the patch.
* Change block rotate undo command from UR_ROTATE to UR_CHANGED so consecutive
  rotations do not lead to round errors and for proper undo in case the user
  changes the rotation angle setting between block rotations.
parent 04f8d12a
......@@ -656,8 +656,8 @@ void PCB_EDIT_FRAME::Block_Delete()
void PCB_EDIT_FRAME::Block_Rotate()
{
wxPoint oldpos;
wxPoint centre; // rotation cent-re for the rotation transform
int rotAngle = 900; // rotation angle in 0.1 deg.
wxPoint centre; // rotation cent-re for the rotation transform
int rotAngle = m_rotationAngle; // rotation angle in 0.1 deg.
oldpos = GetCrossHairPosition();
centre = GetScreen()->m_BlockLocate.Centre();
......@@ -665,14 +665,13 @@ void PCB_EDIT_FRAME::Block_Rotate()
OnModify();
PICKED_ITEMS_LIST* itemsList = &GetScreen()->m_BlockLocate.GetItems();
itemsList->m_Status = UR_ROTATED;
itemsList->m_Status = UR_CHANGED;
for( unsigned ii = 0; ii < itemsList->GetCount(); ii++ )
{
BOARD_ITEM* item = (BOARD_ITEM*) itemsList->GetPickedItem( ii );
wxASSERT( item );
itemsList->SetPickedItemStatus( UR_ROTATED, ii );
item->Rotate( centre, rotAngle );
itemsList->SetPickedItemStatus( UR_CHANGED, ii );
switch( item->Type() )
{
......@@ -706,7 +705,16 @@ void PCB_EDIT_FRAME::Block_Rotate()
}
}
SaveCopyInUndoList( *itemsList, UR_ROTATED, centre );
// Save all the block items in there current state before applying the rotation.
SaveCopyInUndoList( *itemsList, UR_CHANGED, centre );
// Now perform the rotation.
for( unsigned ii = 0; ii < itemsList->GetCount(); ii++ )
{
BOARD_ITEM* item = (BOARD_ITEM*) itemsList->GetPickedItem( ii );
wxASSERT( item );
item->Rotate( centre, rotAngle );
}
Compile_Ratsnest( NULL, true );
m_canvas->Refresh( true );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment