Commit b8a6c53b authored by charras's avatar charras
Browse files

Some minor changes and enhancements

parent e8cb60f9
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -8,7 +8,7 @@
#include "appl_wxstruct.h"
#include "appl_wxstruct.h"




#define BUILD_VERSION "(20091021-unstable)"
#define BUILD_VERSION "(20091024-unstable)"




#ifdef HAVE_SVN_VERSION
#ifdef HAVE_SVN_VERSION
+18 −8
Original line number Original line Diff line number Diff line
@@ -97,15 +97,25 @@ WinEDAListBox::WinEDAListBox( WinEDA_DrawFrame* parent, const wxString& title,
    {
    {
        Centre();
        Centre();
    }
    }
    else    // Ensure the window dialog is on screen :
    else    // Ensure the window dialog is inside the main window :
    {
    {
        wxPoint pos;
        wxPoint pos = dialog_position;
        m_Parent->GetPosition( &pos.x, &pos.y );
        wxPoint maxpos;
        if( pos.x < 0 )
        maxpos.x = parent->GetPosition().x + parent->GetSize().x;
            pos.x = 0;
        maxpos.y = parent->GetPosition().y + parent->GetSize().y;
        if( pos.y < 0 )
        wxPoint endpoint;
            pos.y = 0;
        endpoint.x = pos.x + GetSize().x;
        pos.x += 20; pos.y += 30;
        endpoint.y = pos.y + GetSize().y;

        if( endpoint.x > maxpos.x )
            pos.x -= endpoint.x - maxpos.x;
        if( endpoint.y > maxpos.y )
            pos.y -= endpoint.y - maxpos.y;

        if( pos.x < parent->GetPosition().x )
            pos.x = parent->GetPosition().x;
        if( pos.y < parent->GetPosition().y )
            pos.y = parent->GetPosition().y;
        Move( pos );
        Move( pos );
    }
    }
}
}
+3 −3
Original line number Original line Diff line number Diff line
@@ -88,9 +88,9 @@ void WinEDA_CvpcbFrame::BuildCmpListBox()


    BOOST_FOREACH( COMPONENT & component, m_components ) {
    BOOST_FOREACH( COMPONENT & component, m_components ) {
        msg.Printf( CMP_FORMAT, m_ListCmp->GetCount() + 1,
        msg.Printf( CMP_FORMAT, m_ListCmp->GetCount() + 1,
                   component.m_Reference.GetData(),
                   GetChars(component.m_Reference),
                   component.m_Value.GetData(),
                   GetChars(component.m_Value),
                   component.m_Module.GetData() );
                   GetChars(component.m_Module) );
        m_ListCmp->m_ComponentList.Add( msg );
        m_ListCmp->m_ComponentList.Add( msg );
    }
    }


+56 −15
Original line number Original line Diff line number Diff line
@@ -931,13 +931,18 @@ bool sort_by_pin_number( const LIB_PIN* ref, const LIB_PIN* tst )
}
}




/* Test for duplicate pins:
/* Test for duplicate pins and off grid pins:
 * Pins are considered off grid when they are not on the 25 mils grid
 * A grid smaller than 25 mils must be used only to build graphic shapes.
 */
 */
void WinEDA_LibeditFrame::OnCheckComponent( wxCommandEvent& event )
void WinEDA_LibeditFrame::OnCheckComponent( wxCommandEvent& event )
{
{
    int      error;
    #define MIN_GRID_SIZE 25
    int      dup_error;
    int      offgrid_error;
    LIB_PIN* Pin;
    LIB_PIN* Pin;
    wxString msg;
    wxString msg;
    wxString aux_msg;


    if( m_component == NULL )
    if( m_component == NULL )
        return;
        return;
@@ -962,13 +967,11 @@ void WinEDA_LibeditFrame::OnCheckComponent( wxCommandEvent& event )
    sort( PinList.begin(), PinList.end(), sort_by_pin_number );
    sort( PinList.begin(), PinList.end(), sort_by_pin_number );


    // Test for duplicates:
    // Test for duplicates:
    error = 0;
    dup_error = 0;
    DIALOG_DISPLAY_HTML_TEXT_BASE
    DIALOG_DISPLAY_HTML_TEXT_BASE error_display( this, wxID_ANY, _( "Marker Info" ),
    error_display( this, wxID_ANY, _( "Marker Info" ),
                                                wxDefaultPosition, wxSize( 750, 600 ) );
                                                wxDefaultPosition, wxSize( 750, 600 ) );
    for( unsigned ii = 1; ii < PinList.size(); ii++ )
    for( unsigned ii = 1; ii < PinList.size(); ii++ )
    {
    {
        wxString aux_msg;
        wxString stringPinNum, stringCurrPinNum;
        wxString stringPinNum, stringCurrPinNum;


        LIB_PIN* curr_pin = PinList[ii];
        LIB_PIN* curr_pin = PinList[ii];
@@ -979,7 +982,7 @@ void WinEDA_LibeditFrame::OnCheckComponent( wxCommandEvent& event )
            || Pin->m_Unit != curr_pin->m_Unit )
            || Pin->m_Unit != curr_pin->m_Unit )
            continue;
            continue;


        error++;
        dup_error++;
        Pin->ReturnPinStringNum( stringPinNum );
        Pin->ReturnPinStringNum( stringPinNum );
        curr_pin->ReturnPinStringNum( stringCurrPinNum );
        curr_pin->ReturnPinStringNum( stringCurrPinNum );
        msg.Printf( _(
        msg.Printf( _(
@@ -1007,12 +1010,50 @@ with pin %s \"%s\" at location <b>(%.3f, %.3f)</b>"
        }
        }


        msg += wxT( ".<br>" );
        msg += wxT( ".<br>" );
        error_display.m_htmlWindow->AppendToPage( msg );
    }

    // Test for off grid pins:
    offgrid_error = 0;
    for( unsigned ii = 0; ii < PinList.size(); ii++ )
    {
        Pin = PinList[ii];

        if( ( (Pin->m_Pos.x % MIN_GRID_SIZE) == 0 ) &&
            ( (Pin->m_Pos.y % MIN_GRID_SIZE) == 0 ) )
            continue;

        // A pin is foun here off grid
        offgrid_error++;
        wxString stringPinNum;
        Pin->ReturnPinStringNum( stringPinNum );
        msg.Printf( _( "<b>Off grid pin %s</b> \"%s\" at location <b>(%.3f, %.3f)</b>" ),
                    GetChars( stringPinNum ),
                    GetChars( Pin->m_PinName ),
                    (float) Pin->m_Pos.x / 1000.0, (float) -Pin->m_Pos.y / 1000.0
                    );

        if( m_component->GetPartCount() > 1 )
        {
            aux_msg.Printf( _( " in part %c" ), 'A' + Pin->m_Unit );
            msg += aux_msg;
        }


        if( m_showDeMorgan )
        {
            if( Pin->m_Convert )
                msg += _( "  of converted" );
            else
                msg += _( "  of normal" );
        }

        msg += wxT( ".<br>" );
        error_display.m_htmlWindow->AppendToPage( msg );
        error_display.m_htmlWindow->AppendToPage( msg );
    }
    }


    if( error == 0 )
    if( !dup_error && !offgrid_error )
        DisplayInfoMessage( this, _( "No duplicate pins were found." ) );
        DisplayInfoMessage( this, _( "No off grid or duplicate pins were found." ) );

    else
    else
        error_display.ShowModal();
        error_display.ShowModal();
}
}
+1 −1
Original line number Original line Diff line number Diff line
@@ -153,7 +153,7 @@ void WinEDA_LibeditFrame::ReCreateHToolbar()


    m_HToolBar->AddSeparator();
    m_HToolBar->AddSeparator();
    m_HToolBar->AddTool( ID_LIBEDIT_CHECK_PART, wxEmptyString,
    m_HToolBar->AddTool( ID_LIBEDIT_CHECK_PART, wxEmptyString,
                         wxBitmap( erc_xpm ), _( "Test for duplicate pins" ) );
                         wxBitmap( erc_xpm ), _( "Test for duplicate pins and off grid pins" ) );


    m_HToolBar->AddSeparator();
    m_HToolBar->AddSeparator();
    msg = AddHotkeyName( _( "Zoom in" ), s_Libedit_Hokeys_Descr, HK_ZOOM_IN );
    msg = AddHotkeyName( _( "Zoom in" ), s_Libedit_Hokeys_Descr, HK_ZOOM_IN );
Loading