Commit 98bc9bb9 authored by stambaughw's avatar stambaughw

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.
parent 4653ca50
...@@ -4,7 +4,7 @@ DIALOG_LIB_EDIT_PIN::DIALOG_LIB_EDIT_PIN( wxWindow* parent ) : ...@@ -4,7 +4,7 @@ DIALOG_LIB_EDIT_PIN::DIALOG_LIB_EDIT_PIN( wxWindow* parent ) :
DIALOG_LIB_EDIT_PIN_BASE( parent ) DIALOG_LIB_EDIT_PIN_BASE( parent )
{ {
/* Required to make escape key work correctly in wxGTK. */ /* 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 /* 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 * versions for the flex grid sizer in wxGTK that prevents the last
......
...@@ -34,10 +34,6 @@ void WinEDA_LibeditFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos ) ...@@ -34,10 +34,6 @@ void WinEDA_LibeditFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
switch( DrawEntry->Type() ) switch( DrawEntry->Type() )
{ {
case COMPONENT_PIN_DRAW_TYPE:
PlacePin( DC );
break;
case COMPONENT_FIELD_DRAW_TYPE: case COMPONENT_FIELD_DRAW_TYPE:
PlaceField( DC, (LIB_FIELD*) DrawEntry ); PlaceField( DC, (LIB_FIELD*) DrawEntry );
DrawEntry = NULL; DrawEntry = NULL;
......
...@@ -74,7 +74,10 @@ void WinEDA_LibeditFrame::OnEditPin( wxCommandEvent& event ) ...@@ -74,7 +74,10 @@ void WinEDA_LibeditFrame::OnEditPin( wxCommandEvent& event )
if( dlg.ShowModal() == wxID_CANCEL ) if( dlg.ShowModal() == wxID_CANCEL )
{ {
if( pin->IsNew() ) if( pin->IsNew() )
{
pin->m_Flags |= IS_CANCELLED;
DrawPanel->UnManageCursor(); DrawPanel->UnManageCursor();
}
return; return;
} }
...@@ -296,7 +299,7 @@ static void DrawMovePin( WinEDA_DrawPanel* panel, wxDC* DC, bool erase ) ...@@ -296,7 +299,7 @@ static void DrawMovePin( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
/* Redraw pin in new position */ /* Redraw pin in new position */
CurrentPin->m_Pos.x = panel->GetScreen()->m_Curseur.x; CurrentPin->m_Pos.x = panel->GetScreen()->m_Curseur.x;
CurrentPin->m_Pos.y = -panel->GetScreen()->m_Curseur.y; 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 ); &showPinText, DefaultTransformMatrix );
PinPreviousPos = CurrentPin->m_Pos; PinPreviousPos = CurrentPin->m_Pos;
...@@ -412,8 +415,17 @@ void WinEDA_LibeditFrame::CreatePin( wxDC* DC ) ...@@ -412,8 +415,17 @@ void WinEDA_LibeditFrame::CreatePin( wxDC* DC )
GetEventHandler()->ProcessEvent( cmd ); GetEventHandler()->ProcessEvent( cmd );
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
DrawPanel->m_IgnoreMouseEvents = false; 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;
}
} }
......
...@@ -261,6 +261,7 @@ class DHEAD; ...@@ -261,6 +261,7 @@ class DHEAD;
#define SKIP_STRUCT (1 << 15) ///< flag indiquant que la structure ne doit pas etre traitee #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 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 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 class EDA_BaseStruct
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment