WIP for block rotate and mirror.

Block rotate now doesn't drop the block, but it does introduce one
extra undo step per rotate.

Fixes: lp:1780794
* https://bugs.launchpad.net/kicad/+bug/1780794
This commit is contained in:
Jeff Young 2018-09-05 23:55:11 +01:00
parent 7216eda202
commit 924e56e076
2 changed files with 10 additions and 6 deletions

View File

@ -115,7 +115,7 @@ void SCH_EDIT_FRAME::HandleBlockPlace( wxDC* DC )
wxString msg;
msg.Printf( wxT( "HandleBlockPLace() error : no items to place (cmd %d, state %d)" ),
block->GetCommand(), block->GetState() );
DisplayError( this, msg );
wxFAIL_MSG( msg );
}
block->SetState( STATE_BLOCK_STOP );
@ -193,7 +193,6 @@ bool SCH_EDIT_FRAME::HandleBlockEnd( wxDC* aDC )
bool append = false;
BLOCK_SELECTOR* block = &GetScreen()->m_BlockLocate;
auto panel =static_cast<SCH_DRAW_PANEL*>(m_canvas);
auto view = panel->GetView();
auto area = view->GetSelectionArea();

View File

@ -842,13 +842,18 @@ void SCH_EDIT_FRAME::OnRotate( wxCommandEvent& aEvent )
SCH_SCREEN* screen = GetScreen();
SCH_ITEM* item = screen->GetCurItem();
// INSTALL_UNBUFFERED_DC( dc, m_canvas );
printf("OnRotate\n");
// Allows block rotate operation on hot key.
if( screen->m_BlockLocate.GetState() != STATE_NO_BLOCK )
{
screen->m_BlockLocate.SetCommand( BLOCK_ROTATE );
HandleBlockEnd( nullptr );
// Compute the rotation center and put it on grid:
wxPoint rotationPoint = screen->m_BlockLocate.Centre();
rotationPoint = GetNearestGridPosition( rotationPoint );
SetCrossHairPosition( rotationPoint );
SaveCopyInUndoList( screen->m_BlockLocate.GetItems(), UR_ROTATED, false, rotationPoint );
RotateListOfItems( screen->m_BlockLocate.GetItems(), rotationPoint );
m_canvas->CallMouseCapture( nullptr, wxDefaultPosition, false );
return;
}