Component library pin editing bug fixes from Brian Sidebotham.

* Make cancel button delete new pin instance.
* Make pin redraw correctly to prevent display corruption.
* Prevent edited pin from being move on next left button click.
* Change pin edit property dialog focus to pin name edit text control.
This commit is contained in:
stambaughw 2009-11-11 02:44:58 +00:00
parent 4653ca507a
commit 98bc9bb90b
4 changed files with 17 additions and 8 deletions

View File

@ -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

View File

@ -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;

View File

@ -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;
}
}

View File

@ -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
{