/*
 * Abort current text edit progress.
 * If a text is selected, its initial coord are regenerated
 */
void Abort_Edit_Pcb_Text( EDA_DRAW_PANEL* Panel, wxDC* DC )
{
    TEXTE_PCB* TextePcb = (TEXTE_PCB*) Panel->GetScreen()->GetCurItem();
    ( (PCB_EDIT_FRAME*) Panel->GetParent() )->SetCurItem( NULL );

    Panel->SetMouseCapture( NULL, NULL );

    if( TextePcb == NULL )  // Should not occur
        return;

#ifndef USE_WX_OVERLAY
    TextePcb->Draw( Panel, DC, GR_XOR );
#endif

    if( TextePcb->IsNew() )  // If new: remove it
    {
        TextePcb->DeleteStructure();
        return;
    }


    TextePcb->SwapData( &s_TextCopy );
    TextePcb->ClearFlags();
#ifndef USE_WX_OVERLAY
    TextePcb->Draw( Panel, DC, GR_OR );
#else
    Panel->Refresh();
#endif
}
// Move  PCB text following the cursor.
static void Move_Texte_Pcb( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition,
                            bool aErase )
{
    TEXTE_PCB* TextePcb = (TEXTE_PCB*) aPanel->GetScreen()->GetCurItem();

    if( TextePcb == NULL )
        return;

    if( aErase )
        TextePcb->Draw( aPanel, aDC, GR_XOR );

    TextePcb->SetTextPosition( aPanel->GetParent()->GetCrossHairPosition() );

    TextePcb->Draw( aPanel, aDC, GR_XOR );
}