/** * Abort text move in progress. * * If a text is selected, its initial coordinates are regenerated. */ static void AbortMoveTextModule( EDA_DRAW_PANEL* Panel, wxDC* DC ) { BASE_SCREEN* screen = Panel->GetScreen(); TEXTE_MODULE* Text = static_cast<TEXTE_MODULE*>( screen->GetCurItem() ); MODULE* Module; Panel->SetMouseCapture( NULL, NULL ); if( Text == NULL ) return; Module = static_cast<MODULE*>( Text->GetParent() ); Text->DrawUmbilical( Panel, DC, GR_XOR, -MoveVector ); Text->Draw( Panel, DC, GR_XOR, MoveVector ); // If the text was moved (the move does not change internal data) // it could be rotated while moving. So set old value for orientation if( Text->IsMoving() ) Text->SetTextAngle( TextInitialOrientation ); // Redraw the text Panel->RefreshDrawingRect( Text->GetBoundingBox() ); // leave it at (0,0) so we can use it Rotate when not moving. MoveVector.x = MoveVector.y = 0; Text->ClearFlags(); Module->ClearFlags(); screen->SetCurItem( NULL ); }
void AbortBlockCurrentCommand( EDA_DRAW_PANEL* aPanel, wxDC* aDC ) { BASE_SCREEN* screen = aPanel->GetScreen(); if( aPanel->IsMouseCaptured() ) // Erase current drawing on screen { // Clear block outline. aPanel->CallMouseCapture( aDC, wxDefaultPosition, false ); aPanel->SetMouseCapture( NULL, NULL ); screen->SetCurItem( NULL ); // Delete the picked wrapper if this is a picked list. if( screen->m_BlockLocate.GetCommand() != BLOCK_PASTE ) screen->m_BlockLocate.ClearItemsList(); } screen->m_BlockLocate.SetState( STATE_NO_BLOCK ); screen->m_BlockLocate.SetCommand( BLOCK_ABORT ); aPanel->GetParent()->HandleBlockEnd( aDC ); screen->m_BlockLocate.SetCommand( BLOCK_IDLE ); aPanel->GetParent()->DisplayToolMsg( wxEmptyString ); aPanel->SetCursor( (wxStockCursor) aPanel->GetCurrentCursor() ); }