diff --git a/eeschema/dialog_lib_edit_pin.cpp b/eeschema/dialog_lib_edit_pin.cpp index 6007338c82..e2479c32fa 100644 --- a/eeschema/dialog_lib_edit_pin.cpp +++ b/eeschema/dialog_lib_edit_pin.cpp @@ -4,7 +4,7 @@ DIALOG_LIB_EDIT_PIN::DIALOG_LIB_EDIT_PIN( wxWindow* parent ) : DIALOG_LIB_EDIT_PIN_BASE( parent ) { /* Required to make escape key work correctly in wxGTK. */ - m_sdbSizer1OK->SetFocus(); + m_textName->SetFocus(); /* This ugly hack fixes a bug in wxWidgets 2.8.7 and likely earlier * versions for the flex grid sizer in wxGTK that prevents the last diff --git a/eeschema/libedit_onleftclick.cpp b/eeschema/libedit_onleftclick.cpp index 5e084d4bbc..62a7d007e9 100644 --- a/eeschema/libedit_onleftclick.cpp +++ b/eeschema/libedit_onleftclick.cpp @@ -34,10 +34,6 @@ void WinEDA_LibeditFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos ) switch( DrawEntry->Type() ) { - case COMPONENT_PIN_DRAW_TYPE: - PlacePin( DC ); - break; - case COMPONENT_FIELD_DRAW_TYPE: PlaceField( DC, (LIB_FIELD*) DrawEntry ); DrawEntry = NULL; diff --git a/eeschema/pinedit.cpp b/eeschema/pinedit.cpp index 500177ef2e..701c60e300 100644 --- a/eeschema/pinedit.cpp +++ b/eeschema/pinedit.cpp @@ -74,7 +74,10 @@ void WinEDA_LibeditFrame::OnEditPin( wxCommandEvent& event ) if( dlg.ShowModal() == wxID_CANCEL ) { if( pin->IsNew() ) + { + pin->m_Flags |= IS_CANCELLED; DrawPanel->UnManageCursor(); + } return; } @@ -296,7 +299,7 @@ static void DrawMovePin( WinEDA_DrawPanel* panel, wxDC* DC, bool erase ) /* Redraw pin in new position */ CurrentPin->m_Pos.x = panel->GetScreen()->m_Curseur.x; CurrentPin->m_Pos.y = -panel->GetScreen()->m_Curseur.y; - CurrentPin->Draw( panel, DC, wxPoint( 0, 0 ), -1, wxCOPY, + CurrentPin->Draw( panel, DC, wxPoint( 0, 0 ), -1, g_XorMode, &showPinText, DefaultTransformMatrix ); PinPreviousPos = CurrentPin->m_Pos; @@ -412,8 +415,17 @@ void WinEDA_LibeditFrame::CreatePin( wxDC* DC ) GetEventHandler()->ProcessEvent( cmd ); DrawPanel->MouseToCursorSchema(); DrawPanel->m_IgnoreMouseEvents = false; - DrawPanel->ManageCurseur = DrawMovePin; - DrawPanel->ForceCloseManageCurseur = AbortPinMove; + + if (pin->m_Flags & IS_CANCELLED) + { + DeletePin(DC, m_component, pin); + m_drawItem = NULL; + } + else + { + DrawPanel->ManageCurseur = DrawMovePin; + DrawPanel->ForceCloseManageCurseur = AbortPinMove; + } } diff --git a/include/base_struct.h b/include/base_struct.h index 67bed4e858..fdd2bbf67f 100644 --- a/include/base_struct.h +++ b/include/base_struct.h @@ -261,6 +261,7 @@ class DHEAD; #define SKIP_STRUCT (1 << 15) ///< flag indiquant que la structure ne doit pas etre traitee #define DO_NOT_DRAW (1 << 16) ///< Used to disable draw function #define DRAW_ERASED (1 << 17) ///< draw in background color, used by classs TRACK in gerbview +#define IS_CANCELLED (1 << 18) ///< flag set when edit dialogs are canceled when editing a new object class EDA_BaseStruct {