diff --git a/eeschema/block.cpp b/eeschema/block.cpp index 84583716c9..e82c7abba3 100644 --- a/eeschema/block.cpp +++ b/eeschema/block.cpp @@ -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(m_canvas); auto view = panel->GetView(); auto area = view->GetSelectionArea(); diff --git a/eeschema/schedit.cpp b/eeschema/schedit.cpp index 4a3f683f10..3e7c9ff558 100644 --- a/eeschema/schedit.cpp +++ b/eeschema/schedit.cpp @@ -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; }