Commit 61159202 authored by Dick Hollenbeck's avatar Dick Hollenbeck
Browse files

fix Inner1.Cu in pcb_parser.cpp, start cvpcb work.

parent e2e4fc48
Loading
Loading
Loading
Loading
+2 −1
Original line number Original line Diff line number Diff line
@@ -315,10 +315,11 @@ char* STRING_LINE_READER::ReadLine() throw( IO_ERROR )
}
}




INPUTSTREAM_LINE_READER::INPUTSTREAM_LINE_READER( wxInputStream* aStream ) :
INPUTSTREAM_LINE_READER::INPUTSTREAM_LINE_READER( wxInputStream* aStream, const wxString& aSource ) :
    LINE_READER( LINE_READER_LINE_DEFAULT_MAX ),
    LINE_READER( LINE_READER_LINE_DEFAULT_MAX ),
    m_stream( aStream )
    m_stream( aStream )
{
{
    source = aSource;
}
}




+17 −13
Original line number Original line Diff line number Diff line
@@ -25,7 +25,7 @@
 * @file autosel.cpp
 * @file autosel.cpp
 */
 */


/* Routines for automatic selection of modules. */
// Routines for automatic selection of modules.


#include <fctsys.h>
#include <fctsys.h>
#include <common.h>
#include <common.h>
@@ -42,6 +42,9 @@


#define QUOTE   '\''
#define QUOTE   '\''


#define FMT_TITLE_LIB_LOAD_ERROR    _( "Library Load Error" )


class FOOTPRINT_ALIAS
class FOOTPRINT_ALIAS
{
{
public:
public:
@@ -93,7 +96,7 @@ void CVPCB_MAINFRAME::AssocieModule( wxCommandEvent& event )
    if( m_netlist.IsEmpty() )
    if( m_netlist.IsEmpty() )
        return;
        return;


    /* Find equivalents in all available files. */
    // Find equivalents in all available files.
    for( ii = 0; ii < m_AliasLibNames.GetCount(); ii++ )
    for( ii = 0; ii < m_AliasLibNames.GetCount(); ii++ )
    {
    {
        fn = m_AliasLibNames[ii];
        fn = m_AliasLibNames[ii];
@@ -107,6 +110,7 @@ void CVPCB_MAINFRAME::AssocieModule( wxCommandEvent& event )
        {
        {
            fn.SetExt( fn.GetExt() + wxT( "." ) + FootprintAliasFileExtension );
            fn.SetExt( fn.GetExt() + wxT( "." ) + FootprintAliasFileExtension );
        }
        }

        tmp = search.FindValidPath( fn.GetFullPath() );
        tmp = search.FindValidPath( fn.GetFullPath() );


        if( !tmp )
        if( !tmp )
@@ -114,7 +118,7 @@ void CVPCB_MAINFRAME::AssocieModule( wxCommandEvent& event )
            msg.Printf( _( "Footprint alias library file '%s' could not be found in the "
            msg.Printf( _( "Footprint alias library file '%s' could not be found in the "
                           "default search paths." ),
                           "default search paths." ),
                        GetChars( fn.GetFullName() ) );
                        GetChars( fn.GetFullName() ) );
            wxMessageBox( msg, titleLibLoadError, wxOK | wxICON_ERROR );
            wxMessageBox( msg, FMT_TITLE_LIB_LOAD_ERROR, wxOK | wxICON_ERROR );
            continue;
            continue;
        }
        }


@@ -122,8 +126,8 @@ void CVPCB_MAINFRAME::AssocieModule( wxCommandEvent& event )


        if( file == NULL )
        if( file == NULL )
        {
        {
            msg.Printf( _( "Error opening alias library <%s>." ), GetChars( tmp ) );
            msg.Printf( _( "Error opening alias library '%s'." ), GetChars( tmp ) );
            wxMessageBox( msg, titleLibLoadError, wxOK | wxICON_ERROR );
            wxMessageBox( msg, FMT_TITLE_LIB_LOAD_ERROR, wxOK | wxICON_ERROR );
            continue;
            continue;
        }
        }


@@ -153,7 +157,7 @@ void CVPCB_MAINFRAME::AssocieModule( wxCommandEvent& event )
        fclose( file );
        fclose( file );
    }
    }


    /* Display the number of footprint aliases.  */
    // Display the number of footprint aliases.
    msg.Printf( _( "%d footprint aliases found." ), aliases.size() );
    msg.Printf( _( "%d footprint aliases found." ), aliases.size() );
    SetStatusText( msg, 0 );
    SetStatusText( msg, 0 );


@@ -165,7 +169,7 @@ void CVPCB_MAINFRAME::AssocieModule( wxCommandEvent& event )
        component = m_netlist.GetComponent( kk );
        component = m_netlist.GetComponent( kk );


        bool found = false;
        bool found = false;
        m_ListCmp->SetSelection( ii++, true );
        m_compListBox->SetSelection( ii++, true );


        if( !component->GetFPID().empty() )
        if( !component->GetFPID().empty() )
            continue;
            continue;
@@ -176,8 +180,8 @@ void CVPCB_MAINFRAME::AssocieModule( wxCommandEvent& event )
            if( alias.m_Name.CmpNoCase( component->GetValue() ) != 0 )
            if( alias.m_Name.CmpNoCase( component->GetValue() ) != 0 )
                continue;
                continue;


            /* filter alias so one can use multiple aliases (for polar and nonpolar caps for
            // filter alias so one can use multiple aliases (for polar and
             * example) */
            // nonpolar caps for example)
            const FOOTPRINT_INFO *module = m_footprints.GetModuleInfo( alias.m_FootprintName );
            const FOOTPRINT_INFO *module = m_footprints.GetModuleInfo( alias.m_FootprintName );


            if( module )
            if( module )
@@ -207,11 +211,11 @@ void CVPCB_MAINFRAME::AssocieModule( wxCommandEvent& event )


        }
        }


        /* obviously the last chance: there's only one filter matching one footprint */
        // obviously the last chance: there's only one filter matching one footprint
        if( !found && 1 == component->GetFootprintFilters().GetCount() )
        if( !found && 1 == component->GetFootprintFilters().GetCount() )
        {
        {
            /* we do not need to analyse wildcards: single footprint do not contain them */
            // we do not need to analyse wildcards: single footprint do not
            /* and if there are wildcards it just will not match any */
            // contain them and if there are wildcards it just will not match any
            const FOOTPRINT_INFO* module = m_footprints.GetModuleInfo( component->GetFootprintFilters()[0] );
            const FOOTPRINT_INFO* module = m_footprints.GetModuleInfo( component->GetFootprintFilters()[0] );


            if( module )
            if( module )
+1 −1
Original line number Original line Diff line number Diff line
@@ -481,7 +481,7 @@ void DISPLAY_FOOTPRINTS_FRAME::InitDisplay()


    CVPCB_MAINFRAME* parentframe = (CVPCB_MAINFRAME *) GetParent();
    CVPCB_MAINFRAME* parentframe = (CVPCB_MAINFRAME *) GetParent();


    wxString footprintName = parentframe->m_FootprintList->GetSelectedFootprint();
    wxString footprintName = parentframe->m_footprintListBox->GetSelectedFootprint();


    if( !footprintName.IsEmpty() )
    if( !footprintName.IsEmpty() )
    {
    {
+69 −69
Original line number Original line Diff line number Diff line
@@ -108,9 +108,9 @@ CVPCB_MAINFRAME::CVPCB_MAINFRAME( KIWAY* aKiway, wxWindow* aParent ) :
        wxDefaultSize, KICAD_DEFAULT_DRAWFRAME_STYLE, CVPCB_MAINFRAME_NAME )
        wxDefaultSize, KICAD_DEFAULT_DRAWFRAME_STYLE, CVPCB_MAINFRAME_NAME )
{
{
    m_FrameName             = CVPCB_MAINFRAME_NAME;
    m_FrameName             = CVPCB_MAINFRAME_NAME;
    m_ListCmp               = NULL;
    m_compListBox           = NULL;
    m_FootprintList         = NULL;
    m_footprintListBox      = NULL;
    m_LibraryList           = NULL;
    m_libListBox            = NULL;
    m_mainToolBar           = NULL;
    m_mainToolBar           = NULL;
    m_modified              = false;
    m_modified              = false;
    m_isEESchemaNetlist     = false;
    m_isEESchemaNetlist     = false;
@@ -175,18 +175,18 @@ CVPCB_MAINFRAME::CVPCB_MAINFRAME( KIWAY* aKiway, wxWindow* aParent ) :
        m_auimgr.AddPane( m_mainToolBar,
        m_auimgr.AddPane( m_mainToolBar,
                          wxAuiPaneInfo( horiz ).Name( wxT( "m_mainToolBar" ) ).Top() );
                          wxAuiPaneInfo( horiz ).Name( wxT( "m_mainToolBar" ) ).Top() );


    if( m_ListCmp )
    if( m_compListBox )
        m_auimgr.AddPane( m_ListCmp,
        m_auimgr.AddPane( m_compListBox,
                          wxAuiPaneInfo( horiz ).Name( wxT( "m_ListCmp" ) ).CentrePane() );
                          wxAuiPaneInfo( horiz ).Name( wxT( "m_compListBox" ) ).CentrePane() );


    if( m_LibraryList)
    if( m_libListBox)
        m_auimgr.AddPane( m_LibraryList,
        m_auimgr.AddPane( m_libListBox,
                          wxAuiPaneInfo( info ).Name( wxT( "m_LibraryList" ) ).
                          wxAuiPaneInfo( info ).Name( wxT( "m_libListBox" ) ).
                          Left().BestSize( (int) ( m_FrameSize.x * 0.20 ), m_FrameSize.y ) );
                          Left().BestSize( (int) ( m_FrameSize.x * 0.20 ), m_FrameSize.y ) );


    if( m_FootprintList )
    if( m_footprintListBox )
        m_auimgr.AddPane( m_FootprintList,
        m_auimgr.AddPane( m_footprintListBox,
                          wxAuiPaneInfo( info ).Name( wxT( "m_FootprintList" ) ).
                          wxAuiPaneInfo( info ).Name( wxT( "m_footprintListBox" ) ).
                          Right().BestSize( (int) ( m_FrameSize.x * 0.30 ), m_FrameSize.y ) );
                          Right().BestSize( (int) ( m_FrameSize.x * 0.30 ), m_FrameSize.y ) );


    m_auimgr.Update();
    m_auimgr.Update();
@@ -302,21 +302,21 @@ void CVPCB_MAINFRAME::ChangeFocus( bool aMoveRight )


    if( aMoveRight )
    if( aMoveRight )
    {
    {
        if( hasFocus == m_LibraryList )
        if( hasFocus == m_libListBox )
            m_ListCmp->SetFocus();
            m_compListBox->SetFocus();
        else if( hasFocus == m_ListCmp )
        else if( hasFocus == m_compListBox )
            m_FootprintList->SetFocus();
            m_footprintListBox->SetFocus();
        else if( hasFocus == m_FootprintList )
        else if( hasFocus == m_footprintListBox )
            m_LibraryList->SetFocus();
            m_libListBox->SetFocus();
    }
    }
    else
    else
    {
    {
        if( hasFocus == m_LibraryList )
        if( hasFocus == m_libListBox )
            m_FootprintList->SetFocus();
            m_footprintListBox->SetFocus();
        else if( hasFocus == m_ListCmp )
        else if( hasFocus == m_compListBox )
            m_LibraryList->SetFocus();
            m_libListBox->SetFocus();
        else if( hasFocus == m_FootprintList )
        else if( hasFocus == m_footprintListBox )
            m_ListCmp->SetFocus();
            m_compListBox->SetFocus();
    }
    }
}
}


@@ -326,7 +326,7 @@ void CVPCB_MAINFRAME::ToFirstNA( wxCommandEvent& event )
    if( m_netlist.IsEmpty() )
    if( m_netlist.IsEmpty() )
        return;
        return;


    long selection = m_ListCmp->GetFirstSelected();
    long selection = m_compListBox->GetFirstSelected();


    if( selection < 0 )
    if( selection < 0 )
        selection = -1;     // We will start to 0 for the first search , if no item selected
        selection = -1;     // We will start to 0 for the first search , if no item selected
@@ -335,8 +335,8 @@ void CVPCB_MAINFRAME::ToFirstNA( wxCommandEvent& event )
    {
    {
        if( m_netlist.GetComponent( jj )->GetFPID().empty() )
        if( m_netlist.GetComponent( jj )->GetFPID().empty() )
        {
        {
            m_ListCmp->SetSelection( wxNOT_FOUND, false );  // Remove all selections
            m_compListBox->SetSelection( wxNOT_FOUND, false );  // Remove all selections
            m_ListCmp->SetSelection( jj );
            m_compListBox->SetSelection( jj );
            SendMessageToEESCHEMA();
            SendMessageToEESCHEMA();
            return;
            return;
        }
        }
@@ -349,20 +349,20 @@ void CVPCB_MAINFRAME::ToPreviousNA( wxCommandEvent& event )
    if( m_netlist.IsEmpty() )
    if( m_netlist.IsEmpty() )
        return;
        return;


    int selection = m_ListCmp->GetFirstSelected();
    int selection = m_compListBox->GetFirstSelected();


    if( selection < 0 )
    if( selection < 0 )
        selection = m_ListCmp->GetCount();
        selection = m_compListBox->GetCount();
    else
    else
        while( m_ListCmp->GetNextSelected( selection ) >= 0 )
        while( m_compListBox->GetNextSelected( selection ) >= 0 )
            selection =  m_ListCmp->GetNextSelected( selection );
            selection =  m_compListBox->GetNextSelected( selection );


    for( int kk = selection-1; kk >= 0; kk-- )
    for( int kk = selection-1; kk >= 0; kk-- )
    {
    {
        if( m_netlist.GetComponent( kk )->GetFPID().empty() )
        if( m_netlist.GetComponent( kk )->GetFPID().empty() )
        {
        {
            m_ListCmp->SetSelection( wxNOT_FOUND, false );  // Remove all selections
            m_compListBox->SetSelection( wxNOT_FOUND, false );  // Remove all selections
            m_ListCmp->SetSelection( kk );
            m_compListBox->SetSelection( kk );
            SendMessageToEESCHEMA();
            SendMessageToEESCHEMA();
            return;
            return;
        }
        }
@@ -392,7 +392,7 @@ void CVPCB_MAINFRAME::DelAssociations( wxCommandEvent& event )
    if( IsOK( this, _( "Delete selections" ) ) )
    if( IsOK( this, _( "Delete selections" ) ) )
    {
    {
        m_skipComponentSelect = true;
        m_skipComponentSelect = true;
        m_ListCmp->SetSelection( 0 );
        m_compListBox->SetSelection( 0 );


        for( unsigned i = 0;  i < m_netlist.GetCount();  i++ )
        for( unsigned i = 0;  i < m_netlist.GetCount();  i++ )
        {
        {
@@ -403,7 +403,7 @@ void CVPCB_MAINFRAME::DelAssociations( wxCommandEvent& event )
        }
        }


        m_skipComponentSelect = false;
        m_skipComponentSelect = false;
        m_ListCmp->SetSelection( 0 );
        m_compListBox->SetSelection( 0 );
        m_undefinedComponentCnt = m_netlist.GetCount();
        m_undefinedComponentCnt = m_netlist.GetCount();
    }
    }


@@ -562,8 +562,8 @@ void CVPCB_MAINFRAME::OnSelectComponent( wxListEvent& event )
        filter |= FOOTPRINTS_LISTBOX::BY_LIBRARY;
        filter |= FOOTPRINTS_LISTBOX::BY_LIBRARY;


    component = GetSelectedComponent();
    component = GetSelectedComponent();
    libraryName = m_LibraryList->GetSelectedLibrary();
    libraryName = m_libListBox->GetSelectedLibrary();
    m_FootprintList->SetFootprints( m_footprints, libraryName, component, filter );
    m_footprintListBox->SetFootprints( m_footprints, libraryName, component, filter );


    // Tell AuiMgr that objects are changed !
    // Tell AuiMgr that objects are changed !
    if( m_auimgr.GetManagedWindow() )   // Be sure Aui Manager is initialized
    if( m_auimgr.GetManagedWindow() )   // Be sure Aui Manager is initialized
@@ -578,23 +578,23 @@ void CVPCB_MAINFRAME::OnSelectComponent( wxListEvent& event )
    // but only if the selection is made from the component list or the library list.
    // but only if the selection is made from the component list or the library list.
    // If the selection is made from the footprint list, do not change the current
    // If the selection is made from the footprint list, do not change the current
    // selected footprint.
    // selected footprint.
    if( FindFocus() == m_ListCmp || FindFocus() == m_LibraryList )
    if( FindFocus() == m_compListBox || FindFocus() == m_libListBox )
    {
    {
        wxString module = FROM_UTF8( component->GetFPID().Format().c_str() );
        wxString module = FROM_UTF8( component->GetFPID().Format().c_str() );


        bool found = false;
        bool found = false;


        for( int ii = 0; ii < m_FootprintList->GetCount(); ii++ )
        for( int ii = 0; ii < m_footprintListBox->GetCount(); ii++ )
        {
        {
            wxString footprintName;
            wxString footprintName;
            wxString msg = m_FootprintList->OnGetItemText( ii, 0 );
            wxString msg = m_footprintListBox->OnGetItemText( ii, 0 );
            msg.Trim( true );
            msg.Trim( true );
            msg.Trim( false );
            msg.Trim( false );
            footprintName = msg.AfterFirst( wxChar( ' ' ) );
            footprintName = msg.AfterFirst( wxChar( ' ' ) );


            if( module.Cmp( footprintName ) == 0 )
            if( module.Cmp( footprintName ) == 0 )
            {
            {
                m_FootprintList->SetSelection( ii, true );
                m_footprintListBox->SetSelection( ii, true );
                found = true;
                found = true;
                break;
                break;
            }
            }
@@ -602,10 +602,10 @@ void CVPCB_MAINFRAME::OnSelectComponent( wxListEvent& event )


        if( !found )
        if( !found )
        {
        {
            int ii = m_FootprintList->GetSelection();
            int ii = m_footprintListBox->GetSelection();


            if ( ii >= 0 )
            if ( ii >= 0 )
                m_FootprintList->SetSelection( ii, false );
                m_footprintListBox->SetSelection( ii, false );


            if( GetFpViewerFrame() )
            if( GetFpViewerFrame() )
            {
            {
@@ -638,7 +638,7 @@ void CVPCB_MAINFRAME::DisplayStatus()
    wxString   msg;
    wxString   msg;
    COMPONENT* component;
    COMPONENT* component;


    if( wxWindow::FindFocus() == m_ListCmp || wxWindow::FindFocus() == m_LibraryList )
    if( wxWindow::FindFocus() == m_compListBox || wxWindow::FindFocus() == m_libListBox )
    {
    {
        msg.Printf( _( "Components: %d, unassigned: %d" ), (int) m_netlist.GetCount(),
        msg.Printf( _( "Components: %d, unassigned: %d" ), (int) m_netlist.GetCount(),
                    m_undefinedComponentCnt );
                    m_undefinedComponentCnt );
@@ -665,7 +665,7 @@ void CVPCB_MAINFRAME::DisplayStatus()
    }
    }
    else
    else
    {
    {
        wxString footprintName = m_FootprintList->GetSelectedFootprint();
        wxString footprintName = m_footprintListBox->GetSelectedFootprint();


        FOOTPRINT_INFO* module = m_footprints.GetModuleInfo( footprintName );
        FOOTPRINT_INFO* module = m_footprints.GetModuleInfo( footprintName );


@@ -681,7 +681,7 @@ void CVPCB_MAINFRAME::DisplayStatus()


    msg.Empty();
    msg.Empty();


    if( m_FootprintList )
    if( m_footprintListBox )
    {
    {
        if( m_mainToolBar->GetToolToggled( ID_CVPCB_FOOTPRINT_DISPLAY_FILTERED_LIST ) )
        if( m_mainToolBar->GetToolToggled( ID_CVPCB_FOOTPRINT_DISPLAY_FILTERED_LIST ) )
            msg = _( "key words" );
            msg = _( "key words" );
@@ -707,7 +707,7 @@ void CVPCB_MAINFRAME::DisplayStatus()
        else
        else
            msg = _( "Filtered by " ) + msg;
            msg = _( "Filtered by " ) + msg;


        msg << wxT( ": " ) << m_FootprintList->GetCount();
        msg << wxT( ": " ) << m_footprintListBox->GetCount();


        SetStatusText( msg, 2 );
        SetStatusText( msg, 2 );
    }
    }
@@ -762,7 +762,7 @@ void CVPCB_MAINFRAME::SendMessageToEESCHEMA()
    if( m_netlist.IsEmpty() )
    if( m_netlist.IsEmpty() )
        return;
        return;


    int selection = m_ListCmp->GetSelection();
    int selection = m_compListBox->GetSelection();


    if ( selection < 0 )
    if ( selection < 0 )
        selection = 0;
        selection = 0;
@@ -914,17 +914,17 @@ void CVPCB_MAINFRAME::BuildFOOTPRINTS_LISTBOX()
{
{
    wxFont   guiFont = wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT );
    wxFont   guiFont = wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT );


    if( m_FootprintList == NULL )
    if( m_footprintListBox == NULL )
    {
    {
        m_FootprintList = new FOOTPRINTS_LISTBOX( this, ID_CVPCB_FOOTPRINT_LIST,
        m_footprintListBox = new FOOTPRINTS_LISTBOX( this, ID_CVPCB_FOOTPRINT_LIST,
                                                  wxDefaultPosition, wxDefaultSize );
                                                  wxDefaultPosition, wxDefaultSize );
        m_FootprintList->SetFont( wxFont( guiFont.GetPointSize(),
        m_footprintListBox->SetFont( wxFont( guiFont.GetPointSize(),
                                          wxFONTFAMILY_MODERN,
                                          wxFONTFAMILY_MODERN,
                                          wxFONTSTYLE_NORMAL,
                                          wxFONTSTYLE_NORMAL,
                                          wxFONTWEIGHT_NORMAL ) );
                                          wxFONTWEIGHT_NORMAL ) );
    }
    }


    m_FootprintList->SetFootprints( m_footprints, wxEmptyString, NULL,
    m_footprintListBox->SetFootprints( m_footprints, wxEmptyString, NULL,
                                    FOOTPRINTS_LISTBOX::UNFILTERED );
                                    FOOTPRINTS_LISTBOX::UNFILTERED );
    DisplayStatus();
    DisplayStatus();
}
}
@@ -936,34 +936,34 @@ void CVPCB_MAINFRAME::BuildCmpListBox()
    COMPONENT*  component;
    COMPONENT*  component;
    wxFont      guiFont = wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT );
    wxFont      guiFont = wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT );


    if( m_ListCmp == NULL )
    if( m_compListBox == NULL )
    {
    {
        m_ListCmp = new COMPONENTS_LISTBOX( this, ID_CVPCB_COMPONENT_LIST,
        m_compListBox = new COMPONENTS_LISTBOX( this, ID_CVPCB_COMPONENT_LIST,
                                            wxDefaultPosition, wxDefaultSize );
                                            wxDefaultPosition, wxDefaultSize );
        m_ListCmp->SetFont( wxFont( guiFont.GetPointSize(),
        m_compListBox->SetFont( wxFont( guiFont.GetPointSize(),
                                    wxFONTFAMILY_MODERN,
                                    wxFONTFAMILY_MODERN,
                                    wxFONTSTYLE_NORMAL,
                                    wxFONTSTYLE_NORMAL,
                                    wxFONTWEIGHT_NORMAL ) );
                                    wxFONTWEIGHT_NORMAL ) );
    }
    }


    m_ListCmp->m_ComponentList.Clear();
    m_compListBox->m_ComponentList.Clear();


    for( unsigned i = 0;  i < m_netlist.GetCount();  i++ )
    for( unsigned i = 0;  i < m_netlist.GetCount();  i++ )
    {
    {
        component = m_netlist.GetComponent( i );
        component = m_netlist.GetComponent( i );


        msg.Printf( CMP_FORMAT, m_ListCmp->GetCount() + 1,
        msg.Printf( CMP_FORMAT, m_compListBox->GetCount() + 1,
                    GetChars( component->GetReference() ),
                    GetChars( component->GetReference() ),
                    GetChars( component->GetValue() ),
                    GetChars( component->GetValue() ),
                    GetChars( FROM_UTF8( component->GetFPID().Format().c_str() ) ) );
                    GetChars( FROM_UTF8( component->GetFPID().Format().c_str() ) ) );
        m_ListCmp->m_ComponentList.Add( msg );
        m_compListBox->m_ComponentList.Add( msg );
    }
    }


    if( m_ListCmp->m_ComponentList.Count() )
    if( m_compListBox->m_ComponentList.Count() )
    {
    {
        m_ListCmp->SetItemCount( m_ListCmp->m_ComponentList.Count() );
        m_compListBox->SetItemCount( m_compListBox->m_ComponentList.Count() );
        m_ListCmp->SetSelection( 0, true );
        m_compListBox->SetSelection( 0, true );
        m_ListCmp->RefreshItems( 0L, m_ListCmp->m_ComponentList.Count()-1 );
        m_compListBox->RefreshItems( 0L, m_compListBox->m_ComponentList.Count()-1 );


#if defined (__WXGTK__ )
#if defined (__WXGTK__ )
        // @bug On GTK and wxWidgets 2.8.x, this will assert in debug builds because the
        // @bug On GTK and wxWidgets 2.8.x, this will assert in debug builds because the
@@ -971,9 +971,9 @@ void CVPCB_MAINFRAME::BuildCmpListBox()
        //      ellipsizing long strings down to a few characters.  It still doesn't set
        //      ellipsizing long strings down to a few characters.  It still doesn't set
        //      the scroll bars correctly (too short) but it's better than any of the
        //      the scroll bars correctly (too short) but it's better than any of the
        //      other alternatives.  If someone knows how to fix this, please do.
        //      other alternatives.  If someone knows how to fix this, please do.
        m_ListCmp->SetColumnWidth( -1, wxLIST_AUTOSIZE );
        m_compListBox->SetColumnWidth( -1, wxLIST_AUTOSIZE );
#else
#else
        m_ListCmp->SetColumnWidth( 0, wxLIST_AUTOSIZE );
        m_compListBox->SetColumnWidth( 0, wxLIST_AUTOSIZE );
#endif
#endif
    }
    }
}
}
@@ -983,11 +983,11 @@ void CVPCB_MAINFRAME::BuildLIBRARY_LISTBOX()
{
{
    wxFont   guiFont = wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT );
    wxFont   guiFont = wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT );


    if( m_LibraryList == NULL )
    if( m_libListBox == NULL )
    {
    {
        m_LibraryList = new LIBRARY_LISTBOX( this, ID_CVPCB_LIBRARY_LIST,
        m_libListBox = new LIBRARY_LISTBOX( this, ID_CVPCB_LIBRARY_LIST,
                                             wxDefaultPosition, wxDefaultSize );
                                             wxDefaultPosition, wxDefaultSize );
        m_LibraryList->SetFont( wxFont( guiFont.GetPointSize(),
        m_libListBox->SetFont( wxFont( guiFont.GetPointSize(),
                                        wxFONTFAMILY_MODERN,
                                        wxFONTFAMILY_MODERN,
                                        wxFONTSTYLE_NORMAL,
                                        wxFONTSTYLE_NORMAL,
                                        wxFONTWEIGHT_NORMAL ) );
                                        wxFONTWEIGHT_NORMAL ) );
@@ -1004,14 +1004,14 @@ void CVPCB_MAINFRAME::BuildLIBRARY_LISTBOX()
        for( unsigned ii = 0; ii < libNickNames.size(); ii++ )
        for( unsigned ii = 0; ii < libNickNames.size(); ii++ )
            libNames.Add( libNickNames[ii] );
            libNames.Add( libNickNames[ii] );


        m_LibraryList->SetLibraryList( libNames );
        m_libListBox->SetLibraryList( libNames );
    }
    }
}
}




COMPONENT* CVPCB_MAINFRAME::GetSelectedComponent()
COMPONENT* CVPCB_MAINFRAME::GetSelectedComponent()
{
{
    int selection = m_ListCmp->GetSelection();
    int selection = m_compListBox->GetSelection();


    if( selection >= 0 && selection < (int) m_netlist.GetCount() )
    if( selection >= 0 && selection < (int) m_netlist.GetCount() )
        return m_netlist.GetComponent( selection );
        return m_netlist.GetComponent( selection );
+0 −2
Original line number Original line Diff line number Diff line
@@ -56,8 +56,6 @@ const wxString FootprintAliasFileExtension( wxT( "equ" ) );
// Wildcard for schematic retroannotation (import footprint names in schematic):
// Wildcard for schematic retroannotation (import footprint names in schematic):
const wxString FootprintAliasFileWildcard( _( "KiCad footprint alias files (*.equ)|*.equ" ) );
const wxString FootprintAliasFileWildcard( _( "KiCad footprint alias files (*.equ)|*.equ" ) );


const wxString titleLibLoadError( _( "Library Load Error" ) );



#if 0   // add this logic to OpenProjectFiles()
#if 0   // add this logic to OpenProjectFiles()


Loading