static void AbortSymbolTraceOn( EDA_DRAW_PANEL* Panel, wxDC* DC ) { LIB_EDIT_FRAME* parent = (LIB_EDIT_FRAME*) Panel->GetParent(); LIB_ITEM* item = parent->GetDrawItem(); if( item == NULL ) return; bool newItem = item->IsNew(); item->EndEdit( parent->GetCrossHairPosition( true ), true ); if( newItem ) { delete item; } else parent->RestoreComponent(); parent->SetDrawItem( NULL ); Panel->Refresh(); }
void LIB_EDIT_FRAME::EndDrawGraphicItem( wxDC* DC ) { LIB_ITEM* item = GetDrawItem(); if( item == NULL ) return; if( LIB_PART* part = GetCurPart() ) { if( GetToolId() != ID_NO_TOOL_SELECTED ) SetCursor( wxCURSOR_PENCIL ); else SetCursor( (wxStockCursor) m_canvas->GetDefaultCursor() ); if( GetTempCopyComponent() ) // used when editing an existing item SaveCopyInUndoList( GetTempCopyComponent() ); else { // When creating a new item, there is still no change for the // current symbol. So save it. SaveCopyInUndoList( part ); } if( item->IsNew() ) part->AddDrawItem( item ); item->EndEdit( GetCrossHairPosition( true ) ); SetDrawItem( NULL ); OnModify(); m_canvas->SetMouseCapture( NULL, NULL ); m_canvas->Refresh(); } }