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:
parent
7216eda202
commit
924e56e076
|
@ -115,7 +115,7 @@ void SCH_EDIT_FRAME::HandleBlockPlace( wxDC* DC )
|
||||||
wxString msg;
|
wxString msg;
|
||||||
msg.Printf( wxT( "HandleBlockPLace() error : no items to place (cmd %d, state %d)" ),
|
msg.Printf( wxT( "HandleBlockPLace() error : no items to place (cmd %d, state %d)" ),
|
||||||
block->GetCommand(), block->GetState() );
|
block->GetCommand(), block->GetState() );
|
||||||
DisplayError( this, msg );
|
wxFAIL_MSG( msg );
|
||||||
}
|
}
|
||||||
|
|
||||||
block->SetState( STATE_BLOCK_STOP );
|
block->SetState( STATE_BLOCK_STOP );
|
||||||
|
@ -193,7 +193,6 @@ bool SCH_EDIT_FRAME::HandleBlockEnd( wxDC* aDC )
|
||||||
bool append = false;
|
bool append = false;
|
||||||
BLOCK_SELECTOR* block = &GetScreen()->m_BlockLocate;
|
BLOCK_SELECTOR* block = &GetScreen()->m_BlockLocate;
|
||||||
|
|
||||||
|
|
||||||
auto panel =static_cast<SCH_DRAW_PANEL*>(m_canvas);
|
auto panel =static_cast<SCH_DRAW_PANEL*>(m_canvas);
|
||||||
auto view = panel->GetView();
|
auto view = panel->GetView();
|
||||||
auto area = view->GetSelectionArea();
|
auto area = view->GetSelectionArea();
|
||||||
|
|
|
@ -842,13 +842,18 @@ void SCH_EDIT_FRAME::OnRotate( wxCommandEvent& aEvent )
|
||||||
SCH_SCREEN* screen = GetScreen();
|
SCH_SCREEN* screen = GetScreen();
|
||||||
SCH_ITEM* item = screen->GetCurItem();
|
SCH_ITEM* item = screen->GetCurItem();
|
||||||
|
|
||||||
// INSTALL_UNBUFFERED_DC( dc, m_canvas );
|
|
||||||
printf("OnRotate\n");
|
|
||||||
// Allows block rotate operation on hot key.
|
// Allows block rotate operation on hot key.
|
||||||
if( screen->m_BlockLocate.GetState() != STATE_NO_BLOCK )
|
if( screen->m_BlockLocate.GetState() != STATE_NO_BLOCK )
|
||||||
{
|
{
|
||||||
screen->m_BlockLocate.SetCommand( BLOCK_ROTATE );
|
// Compute the rotation center and put it on grid:
|
||||||
HandleBlockEnd( nullptr );
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue