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

*) Switch over to FP_LIB_TABLE::Footprint*() functions.

*) Set environment variable KISYSMOD before loading FP_LIB_TABLE so that
   FP_LIB_TABLE::ROW::SetFullURI() can do substitution up front.
*) De-emphasize the lib path in some of the footprint frames but keep it
   so the footprint editor can export a current library to another.
   You can even export a GITHUB library to a pretty library for local 
   installation.
*) Start the PLUGIN options editor.
*) Enhance cursor positioning in DIALOG_FP_LIB_TABLE.
parent 7f648995
Loading
Loading
Loading
Loading
+1 −7
Original line number Original line Diff line number Diff line
@@ -49,16 +49,10 @@ option( KICAD_SCRIPTING_WXPYTHON


option( USE_FP_LIB_TABLE "Use the new footprint library table implementation. ( default OFF)" )
option( USE_FP_LIB_TABLE "Use the new footprint library table implementation. ( default OFF)" )


# BUILD_GITHUB_PLUGIN for MINGW is pretty demanding due to download_openssl.cmake and openssl's
# use of perl to drive its configure step.  You might find it works in a cross builder say on linux.
# Dick is not personally supporting Windows any more with this exotic stuff.  Some other windows
# developer will have to smooth out the build issues.  So enable this for MINGW without my help but
# with my best wishes.
option( BUILD_GITHUB_PLUGIN "Build the GITHUB_PLUGIN for pcbnew." OFF )
option( BUILD_GITHUB_PLUGIN "Build the GITHUB_PLUGIN for pcbnew." OFF )




# Set version option (stable or testing)
# Set version option (stable or testing)

if( KICAD_STABLE_VERSION)
if( KICAD_STABLE_VERSION)
    add_definitions( -DKICAD_STABLE_VERSION )
    add_definitions( -DKICAD_STABLE_VERSION )
    message( STATUS "Building stable version of KiCad" )
    message( STATUS "Building stable version of KiCad" )
+1 −1
Original line number Original line Diff line number Diff line
@@ -56,4 +56,4 @@ ExternalProject_Add( avhttp




set( AVHTTP_INCLUDE_DIR  "${PREFIX}/include" CACHE FILEPATH "AVHTTP include directory" )
set( AVHTTP_INCLUDE_DIR  "${PREFIX}/include" CACHE FILEPATH "AVHTTP include directory" )
mark_as_advanced( AVHTTP_INCLUDE_DIR )
+7 −2
Original line number Original line Diff line number Diff line
@@ -42,6 +42,8 @@ if( BUILD_GITHUB_PLUGIN )
    # Chosen libraries are based on AVHTTP requirements, and possibly
    # Chosen libraries are based on AVHTTP requirements, and possibly
    # unit_test_framework for its own worth.
    # unit_test_framework for its own worth.
    set( BOOST_LIBS_BUILT
    set( BOOST_LIBS_BUILT
        context
        #coroutine
        date_time
        date_time
        #exception
        #exception
        filesystem
        filesystem
@@ -172,14 +174,17 @@ if( BUILD_GITHUB_PLUGIN )


    set( boost_libs "" )
    set( boost_libs "" )
    set_boost_lib_names( "${BOOST_LIBS_BUILT}" boost_libs )
    set_boost_lib_names( "${BOOST_LIBS_BUILT}" boost_libs )
    #message( STATUS "BOOST_ROOT:${BOOST_ROOT}  boost_libs:${boost_libs}" )

    set( Boost_LIBRARIES    ${boost_libs}      CACHE FILEPATH "Boost libraries directory" )
    set( Boost_LIBRARIES    ${boost_libs}      CACHE FILEPATH "Boost libraries directory" )
    set( Boost_INCLUDE_DIR  "${BOOST_INCLUDE}" CACHE FILEPATH "Boost include directory" )
    set( Boost_INCLUDE_DIR  "${BOOST_INCLUDE}" CACHE FILEPATH "Boost include directory" )

    mark_as_advanced( Boost_LIBRARIES Boost_INCLUDE_DIR )

    #message( STATUS "BOOST_ROOT:${BOOST_ROOT}  BOOST_LIBRARIES:${BOOST_LIBRARIES}" )
    #message( STATUS "Boost_INCLUDE_DIR: ${Boost_INCLUDE_DIR}" )
    #message( STATUS "Boost_INCLUDE_DIR: ${Boost_INCLUDE_DIR}" )


else( BUILD_GITHUB_PLUGIN )
else( BUILD_GITHUB_PLUGIN )



    ExternalProject_Add( boost
    ExternalProject_Add( boost
        PREFIX          "${PREFIX}"
        PREFIX          "${PREFIX}"
        DOWNLOAD_DIR    "${DOWNLOAD_DIR}"
        DOWNLOAD_DIR    "${DOWNLOAD_DIR}"
+2 −8
Original line number Original line Diff line number Diff line
@@ -151,11 +151,5 @@ Dick's Final TODO List:
*) Get licensing cleaned up.
*) Get licensing cleaned up.
*) Re-arrange the repo architecture.
*) Re-arrange the repo architecture.
*) Merge KiCad GAL/TOM/ORSON if nobody else does.
*) Merge KiCad GAL/TOM/ORSON if nobody else does.
*) lib_convert.py (i.e. convert) all footprint libraries to pretty format and move copy them to
*) DLL-ization of pcbnew & eeschema
   github if nobody else does.
   http://www.eevblog.com/forum/open-source-kicad-geda/seriously-irritated-with-the-library-editor!/
*) DLL-ization of pcbnew eeschema
*) Pass options, i.e. PROPERTIES to all PLUGIN::Footprint*() calls.  Current code needs
   to be based on NickNames, not Libpaths, so we have access to the FP_LIB_TABLE::ROWs.
   User should not be prompted for a libpath for reading from it, he/she must pick from the
   known list of nicknames. Possibly duplicate some of the PLUGIN:::Footprint*() api in ROW or
   FP_LIB_TABLE. Again, limited to PLUGIN::Footprint*() calls, not Load() and Save().
+26 −32
Original line number Original line Diff line number Diff line
@@ -43,8 +43,9 @@


#include <class_module.h>
#include <class_module.h>


#if !defined( USE_FP_LIB_TABLE )


bool FOOTPRINT_LIST::ReadFootprintFiles( wxArrayString& aFootprintsLibNames )
bool FOOTPRINT_LIST::ReadFootprintFiles( wxArrayString& aFootprintLibNames )
{
{
    bool retv = true;
    bool retv = true;


@@ -58,10 +59,10 @@ bool FOOTPRINT_LIST::ReadFootprintFiles( wxArrayString& aFootprintsLibNames )
        PLUGIN::RELEASER pi( IO_MGR::PluginFind( IO_MGR::LEGACY ) );
        PLUGIN::RELEASER pi( IO_MGR::PluginFind( IO_MGR::LEGACY ) );


        // Parse Libraries Listed
        // Parse Libraries Listed
        for( unsigned ii = 0; ii < aFootprintsLibNames.GetCount(); ii++ )
        for( unsigned ii = 0; ii < aFootprintLibNames.GetCount(); ii++ )
        {
        {
            // Footprint library file names can be fully qualified or file name only.
            // Footprint library file names can be fully qualified or file name only.
            wxFileName filename = aFootprintsLibNames[ii];
            wxFileName filename = aFootprintLibNames[ii];


            if( !filename.FileExists() )
            if( !filename.FileExists() )
            {
            {
@@ -69,19 +70,19 @@ bool FOOTPRINT_LIST::ReadFootprintFiles( wxArrayString& aFootprintsLibNames )


                if( !filename.FileExists() )
                if( !filename.FileExists() )
                {
                {
                    filename = wxFileName( wxEmptyString, aFootprintsLibNames[ii],
                    filename = wxFileName( wxEmptyString, aFootprintLibNames[ii],
                                           LegacyFootprintLibPathExtension );
                                           LegacyFootprintLibPathExtension );


                    filename = wxGetApp().FindLibraryPath( filename.GetFullName() );
                    filename = wxGetApp().FindLibraryPath( filename.GetFullName() );
                }
                }
            }
            }


            wxLogDebug( wxT( "Path <%s> -> <%s>." ), GetChars( aFootprintsLibNames[ii] ),
            wxLogDebug( wxT( "Path <%s> -> <%s>." ), GetChars( aFootprintLibNames[ii] ),
                        GetChars( filename.GetFullPath() ) );
                        GetChars( filename.GetFullPath() ) );


            if( !filename.IsOk() || !filename.FileExists() )
            if( !filename.IsOk() || !filename.FileExists() )
            {
            {
                m_filesNotFound << aFootprintsLibNames[ii] << wxT( "\n" );
                m_filesNotFound << aFootprintLibNames[ii] << wxT( "\n" );
                retv = false;
                retv = false;
                continue;
                continue;
            }
            }
@@ -131,8 +132,9 @@ bool FOOTPRINT_LIST::ReadFootprintFiles( wxArrayString& aFootprintsLibNames )
    return retv;
    return retv;
}
}


#else


bool FOOTPRINT_LIST::ReadFootprintFiles( FP_LIB_TABLE& aTable )
bool FOOTPRINT_LIST::ReadFootprintFiles( FP_LIB_TABLE* aTable, const wxString* aNickname )
{
{
    bool retv = true;
    bool retv = true;


@@ -141,44 +143,35 @@ bool FOOTPRINT_LIST::ReadFootprintFiles( FP_LIB_TABLE& aTable )
    m_filesInvalid.Empty();
    m_filesInvalid.Empty();
    m_List.clear();
    m_List.clear();


    std::vector< wxString > libNickNames = aTable.GetLogicalLibs();
    std::vector< wxString > nicknames;


    // Parse Libraries Listed
    if( !aNickname )
    for( unsigned ii = 0; ii < libNickNames.size(); ii++ )
        // do all of them
    {
        nicknames = aTable->GetLogicalLibs();
        const FP_LIB_TABLE::ROW* row = aTable.FindRow( libNickNames[ii] );
    else
        nicknames.push_back( *aNickname );


        wxCHECK2_MSG( row != NULL, retv = false; continue,
    for( unsigned ii = 0; ii < nicknames.size(); ii++ )
                      wxString::Format( wxT( "No library name <%s> found in footprint library "
                                             "table." ), GetChars( libNickNames[ii] ) ) );
        try
    {
    {
            PLUGIN* plugin = IO_MGR::PluginFind( IO_MGR::EnumFromStr( row->GetType() ) );
        const wxString& nickname = nicknames[ii];


            if( plugin == NULL )
        try
        {
        {
                m_filesNotFound << wxString::Format( _( "Cannot find plugin type '%s'." ),
            wxArrayString fpnames = aTable->FootprintEnumerate( nickname );
                                                     GetChars( row->GetType() ) );
                retv = false;
                continue;
            }

            PLUGIN::RELEASER pi( plugin );

            wxString      path = FP_LIB_TABLE::ExpandSubstitutions( row->GetFullURI() );
            wxArrayString fpnames = pi->FootprintEnumerate( path );


            for( unsigned i=0;  i<fpnames.GetCount();  ++i )
            for( unsigned i=0;  i<fpnames.GetCount();  ++i )
            {
            {
                std::auto_ptr<MODULE> m( pi->FootprintLoad( path, fpnames[i] ) );
                std::auto_ptr<MODULE> m( aTable->FootprintLoad( nickname, fpnames[i] ) );


                // we're loading what we enumerated, all must be there.
                // we're loading what we enumerated, all must be there.
                wxASSERT( m.get() );
                wxASSERT( m.get() );


                FOOTPRINT_INFO* fpinfo = new FOOTPRINT_INFO();
                FOOTPRINT_INFO* fpinfo = new FOOTPRINT_INFO();


                fpinfo->SetLibraryName( libNickNames[ii] );
                fpinfo->SetLibraryName( nickname );
                fpinfo->SetLibraryPath( path );

                //fpinfo->SetLibraryPath( path );

                fpinfo->m_Module   = fpnames[i];
                fpinfo->m_Module   = fpnames[i];
                fpinfo->m_padCount = m->GetPadCount( MODULE::DO_NOT_INCLUDE_NPTH );
                fpinfo->m_padCount = m->GetPadCount( MODULE::DO_NOT_INCLUDE_NPTH );
                fpinfo->m_KeyWord  = m->GetKeywords();
                fpinfo->m_KeyWord  = m->GetKeywords();
@@ -199,6 +192,7 @@ bool FOOTPRINT_LIST::ReadFootprintFiles( FP_LIB_TABLE& aTable )
    return retv;
    return retv;
}
}


#endif  // USE_FP_LIB_TABLE


FOOTPRINT_INFO* FOOTPRINT_LIST::GetModuleInfo( const wxString& aFootprintName )
FOOTPRINT_INFO* FOOTPRINT_LIST::GetModuleInfo( const wxString& aFootprintName )
{
{
Loading