Commit ccfa4e0a authored by charras's avatar charras
Browse files

Eeschema: Libedit: fixed hang when using the repeat function (insert key) after creating a pin.

Fixed others minor problems 
parent d1f2a16c
Loading
Loading
Loading
Loading
+21 −23
Original line number Diff line number Diff line
@@ -76,13 +76,14 @@ WinEDA_DrawPanel::WinEDA_DrawPanel( WinEDA_DrawFrame* parent, int id,
    SetBackgroundColour( wxColour( ColorRefs[g_DrawBgColor].m_Red,
                                   ColorRefs[g_DrawBgColor].m_Green,
                                   ColorRefs[g_DrawBgColor].m_Blue ) );
    SetBackgroundStyle( wxBG_STYLE_CUSTOM );

    EnableScrolling( TRUE, TRUE );
    m_ClipBox.SetSize( size );
    m_ClipBox.SetX( 0 );
    m_ClipBox.SetY( 0 );
    m_CanStartBlock     = -1; // Command block can start if >= 0
    m_AbortEnable       = m_AbortRequest = FALSE;
    m_AbortEnable       = m_AbortRequest = false;
    m_AutoPAN_Enable    = TRUE;
    m_IgnoreMouseEvents = 0;

@@ -93,8 +94,8 @@ WinEDA_DrawPanel::WinEDA_DrawPanel( WinEDA_DrawFrame* parent, int id,
        wxGetApp().m_EDA_Config->Read( wxT( "AutoPAN" ), &m_AutoPAN_Enable,
                                       true );

    m_AutoPAN_Request    = FALSE;
    m_Block_Enable       = FALSE;
    m_AutoPAN_Request    = false;
    m_Block_Enable       = false;
    m_PanelDefaultCursor = m_PanelCursor = wxCURSOR_ARROW;
    m_CursorLevel = 0;
    m_PrintIsMirrored = false;
@@ -212,7 +213,7 @@ wxPoint WinEDA_DrawPanel::CursorRealPosition( const wxPoint& ScreenPos )
/** Function IsPointOnDisplay
 * @param ref_pos is the position to test in pixels, relative to the panel.
 * @return TRUE if ref_pos is a point currently visible on screen
 *         FALSE if ref_pos is out of screen
 *         false if ref_pos is out of screen
 */
bool WinEDA_DrawPanel::IsPointOnDisplay( wxPoint ref_pos )
{
@@ -225,7 +226,7 @@ bool WinEDA_DrawPanel::IsPointOnDisplay( wxPoint ref_pos )
    // Slightly decreased the size of the useful screen area  to avoid drawing
    // limits.
    #define PIXEL_MARGIN 8
    display_rect.Inflate( -PIXEL_MARGIN, -PIXEL_MARGIN );
    display_rect.Inflate( -PIXEL_MARGIN );

    // Convert physical coordinates.
    pos = CalcUnscrolledPosition( display_rect.GetPosition() );
@@ -564,11 +565,7 @@ void WinEDA_DrawPanel::OnPaint( wxPaintEvent& event )
    // Fix for pixel offset bug http://trac.wxwidgets.org/ticket/4187
    paintDC.GetGraphicsContext()->Translate(0.5, 0.5);
#else
    #ifdef KICAD_USE_BUFFERED_DC
    wxBufferedPaintDC paintDC( this );
    #else
    wxPaintDC paintDC( this );
    #endif
    INSTALL_PAINTDC( paintDC, this );
#endif
    EDA_Rect  tmp;
    wxRect    PaintClipBox;
@@ -622,7 +619,7 @@ void WinEDA_DrawPanel::OnPaint( wxPaintEvent& event )
#endif

    // Be sure the drawpanel clipbox is bigger than the region to repair:
    m_ClipBox.Inflate(1,1); // Give it one pixel more in each direction
    m_ClipBox.Inflate(1); // Give it one pixel more in each direction

#if 0 && defined (DEBUG)
    printf( "2) PaintClipBox=(%d, %d, %d, %d) org=(%d, %d) m_ClipBox=(%d, %d, %d, %d)\n",
@@ -705,7 +702,7 @@ void WinEDA_DrawPanel::DrawBackGround( wxDC* DC )
    BASE_SCREEN* screen = GetScreen();
    int          ii, jj, xg, yg, color;
    wxRealPoint  screen_grid_size;
    bool         drawgrid = FALSE;
    bool         drawgrid = false;
    wxSize       size;
    wxPoint      org;

@@ -729,7 +726,7 @@ void WinEDA_DrawPanel::DrawBackGround( wxDC* DC )
        dgrid.x *= 2;
    }
    if( dgrid.x < 5 )
        drawgrid = FALSE; // The grid is too small: do not show it
        drawgrid = false; // The grid is too small: do not show it

    if( dgrid.y < 5 )
    {
@@ -737,7 +734,7 @@ void WinEDA_DrawPanel::DrawBackGround( wxDC* DC )
        dgrid.y *= 2;
    }
    if( dgrid.y < 5 )
        drawgrid = FALSE; // The grid is too small
        drawgrid = false; // The grid is too small

    GetViewStart( &org.x, &org.y );
    GetScrollPixelsPerUnit( &ii, &jj );
@@ -856,7 +853,7 @@ bool WinEDA_DrawPanel::OnRightClick( wxMouseEvent& event )
    m_IgnoreMouseEvents = TRUE;
    PopupMenu( &MasterMenu, pos );
    MouseToCursorSchema();
    m_IgnoreMouseEvents = FALSE;
    m_IgnoreMouseEvents = false;

    return true;
}
@@ -866,7 +863,7 @@ bool WinEDA_DrawPanel::OnRightClick( wxMouseEvent& event )
void WinEDA_DrawPanel::OnMouseLeaving( wxMouseEvent& event )
{
    if( ManageCurseur == NULL )          // No command in progress.
        m_AutoPAN_Request = FALSE;
        m_AutoPAN_Request = false;

    if( !m_AutoPAN_Enable || !m_AutoPAN_Request || m_IgnoreMouseEvents )
        return;
@@ -899,11 +896,12 @@ void WinEDA_DrawPanel::OnMouseWheel( wxMouseEvent& event )
    if( event.GetWheelRotation() == 0 || !GetParent()->IsEnabled()
        || !rect.Contains( event.GetPosition() ) )
    {
#if 0
        wxLogDebug( wxT( "OnMouseWheel() position(%d, %d) " ) \
                    wxT( "rectangle(%d, %d, %d, %d)" ),
                    event.GetPosition().x, event.GetPosition().y,
                    rect.x, rect.y, rect.width, rect.height );

#endif
        event.Skip();
        return;
    }
@@ -964,7 +962,7 @@ void WinEDA_DrawPanel::OnMouseEvent( wxMouseEvent& event )
    }

    if( ManageCurseur == NULL )  // No command in progress
        m_AutoPAN_Request = FALSE;
        m_AutoPAN_Request = false;

    if( m_Parent->m_FrameIsActive )
        SetFocus();
@@ -1123,7 +1121,7 @@ void WinEDA_DrawPanel::OnMouseEvent( wxMouseEvent& event )
        {
            if( screen->m_BlockLocate.m_State == STATE_BLOCK_MOVE )
            {
                m_AutoPAN_Request = FALSE;
                m_AutoPAN_Request = false;
                m_Parent->HandleBlockPlace( &DC );
                s_IgnoreNextLeftButtonRelease = true;
            }
@@ -1188,13 +1186,13 @@ void WinEDA_DrawPanel::OnMouseEvent( wxMouseEvent& event )
                if( ForceCloseManageCurseur )
                {
                    ForceCloseManageCurseur( this, &DC );
                    m_AutoPAN_Request = FALSE;
                    m_AutoPAN_Request = false;
                }
                SetCursor( m_PanelCursor = m_PanelDefaultCursor );
            }
            else if( screen->m_BlockLocate.m_State == STATE_BLOCK_END )
            {
                m_AutoPAN_Request = FALSE;
                m_AutoPAN_Request = false;
                m_Parent->HandleBlockEnd( &DC );
                SetCursor( m_PanelCursor = m_PanelDefaultCursor );
                if( screen->m_BlockLocate.m_State == STATE_BLOCK_MOVE )
@@ -1216,7 +1214,7 @@ void WinEDA_DrawPanel::OnMouseEvent( wxMouseEvent& event )
            if( ForceCloseManageCurseur )
            {
                ForceCloseManageCurseur( this, &DC );
                m_AutoPAN_Request = FALSE;
                m_AutoPAN_Request = false;
            }
        }
    }
@@ -1237,7 +1235,7 @@ void WinEDA_DrawPanel::OnMouseEvent( wxMouseEvent& event )
void WinEDA_DrawPanel::OnKeyEvent( wxKeyEvent& event )
{
    long    key, localkey;
    bool    escape = FALSE;
    bool    escape = false;
    wxPoint pos;

    key = localkey = event.GetKeyCode();
+1 −1
Original line number Diff line number Diff line
@@ -1561,7 +1561,7 @@ void LIB_POLYLINE::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC,

        if( Buf_Poly_Drawings == NULL )
        {
            DisplayError( NULL, _( "Cannot allocate memory to draw polylines." ) );
            DisplayError( NULL, wxT( "Cannot allocate memory to draw polylines." ) );
        }
    }

+6 −6
Original line number Diff line number Diff line
@@ -103,7 +103,7 @@
                                <property name="font"></property>
                                <property name="hidden">0</property>
                                <property name="id">wxID_ANY</property>
                                <property name="label">&amp;Name:</property>
                                <property name="label">Pin &amp;name:</property>
                                <property name="maximum_size"></property>
                                <property name="minimum_size"></property>
                                <property name="name">m_staticText1</property>
@@ -376,7 +376,7 @@
                                <property name="font"></property>
                                <property name="hidden">0</property>
                                <property name="id">wxID_ANY</property>
                                <property name="label">N&amp;umber:</property>
                                <property name="label">Pin n&amp;umber:</property>
                                <property name="maximum_size"></property>
                                <property name="minimum_size"></property>
                                <property name="name">m_staticText4</property>
@@ -385,7 +385,7 @@
                                <property name="size"></property>
                                <property name="style"></property>
                                <property name="subclass"></property>
                                <property name="tooltip"></property>
                                <property name="tooltip">Pin number: 1 to 4 ASCII letters and/or digits</property>
                                <property name="window_extra_style"></property>
                                <property name="window_name"></property>
                                <property name="window_style"></property>
@@ -918,7 +918,7 @@
                                <property name="font"></property>
                                <property name="hidden">0</property>
                                <property name="id">wxID_ANY</property>
                                <property name="label">&amp;Electical type:</property>
                                <property name="label">&amp;Electrical type:</property>
                                <property name="maximum_size"></property>
                                <property name="minimum_size"></property>
                                <property name="name">m_staticText6</property>
@@ -927,7 +927,7 @@
                                <property name="size"></property>
                                <property name="style"></property>
                                <property name="subclass"></property>
                                <property name="tooltip"></property>
                                <property name="tooltip">Used by the ERC.</property>
                                <property name="window_extra_style"></property>
                                <property name="window_name"></property>
                                <property name="window_style"></property>
@@ -1060,7 +1060,7 @@
                                <property name="font"></property>
                                <property name="hidden">0</property>
                                <property name="id">wxID_ANY</property>
                                <property name="label">&amp;Style:</property>
                                <property name="label">Graphic &amp;Style:</property>
                                <property name="maximum_size"></property>
                                <property name="minimum_size"></property>
                                <property name="name">m_staticText7</property>
+8 −4
Original line number Diff line number Diff line
@@ -21,7 +21,7 @@ DIALOG_LIB_EDIT_PIN_BASE::DIALOG_LIB_EDIT_PIN_BASE( wxWindow* parent, wxWindowID
	fgSizer1->SetFlexibleDirection( wxBOTH );
	fgSizer1->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_ALL );
	
	m_staticText1 = new wxStaticText( this, wxID_ANY, _("&Name:"), wxDefaultPosition, wxDefaultSize, 0 );
	m_staticText1 = new wxStaticText( this, wxID_ANY, _("Pin &name:"), wxDefaultPosition, wxDefaultSize, 0 );
	m_staticText1->Wrap( -1 );
	fgSizer1->Add( m_staticText1, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 );
	
@@ -42,8 +42,10 @@ DIALOG_LIB_EDIT_PIN_BASE::DIALOG_LIB_EDIT_PIN_BASE( wxWindow* parent, wxWindowID
	m_staticNameTextSizeUnits->Wrap( -1 );
	fgSizer1->Add( m_staticNameTextSizeUnits, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 );
	
	m_staticText4 = new wxStaticText( this, wxID_ANY, _("N&umber:"), wxDefaultPosition, wxDefaultSize, 0 );
	m_staticText4 = new wxStaticText( this, wxID_ANY, _("Pin n&umber:"), wxDefaultPosition, wxDefaultSize, 0 );
	m_staticText4->Wrap( -1 );
	m_staticText4->SetToolTip( _("Pin number: 1 to 4 ASCII letters and/or digits") );
	
	fgSizer1->Add( m_staticText4, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 );
	
	m_textNumber = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
@@ -86,8 +88,10 @@ DIALOG_LIB_EDIT_PIN_BASE::DIALOG_LIB_EDIT_PIN_BASE( wxWindow* parent, wxWindowID
	m_staticLengthUnits->Wrap( -1 );
	fgSizer1->Add( m_staticLengthUnits, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 );
	
	m_staticText6 = new wxStaticText( this, wxID_ANY, _("&Electical type:"), wxDefaultPosition, wxDefaultSize, 0 );
	m_staticText6 = new wxStaticText( this, wxID_ANY, _("&Electrical type:"), wxDefaultPosition, wxDefaultSize, 0 );
	m_staticText6->Wrap( -1 );
	m_staticText6->SetToolTip( _("Used by the ERC.") );
	
	fgSizer1->Add( m_staticText6, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 );
	
	wxArrayString m_choiceElectricalTypeChoices;
@@ -107,7 +111,7 @@ DIALOG_LIB_EDIT_PIN_BASE::DIALOG_LIB_EDIT_PIN_BASE( wxWindow* parent, wxWindowID
	
	fgSizer1->Add( 0, 0, 0, wxEXPAND, 3 );
	
	m_staticText7 = new wxStaticText( this, wxID_ANY, _("&Style:"), wxDefaultPosition, wxDefaultSize, 0 );
	m_staticText7 = new wxStaticText( this, wxID_ANY, _("Graphic &Style:"), wxDefaultPosition, wxDefaultSize, 0 );
	m_staticText7->Wrap( -1 );
	fgSizer1->Add( m_staticText7, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 );
	
+3 −0
Original line number Diff line number Diff line
@@ -654,6 +654,9 @@ void WinEDA_LibeditFrame::Process_Special_Functions( wxCommandEvent& event )
    INSTALL_DC( dc, DrawPanel );
    switch( id )
    {
    case ID_POPUP_LIBEDIT_CANCEL_EDITING:
        break;

    case ID_LIBEDIT_SELECT_CURRENT_LIB:
        SelectActiveLibrary();
        break;
Loading